Skip to content

Commit

Permalink
Handle PDB deletion
Browse files Browse the repository at this point in the history
Co-authored-by: Grzegorz Piotrowski <[email protected]>
  • Loading branch information
adam-cattermole and grzpiotrowski committed Aug 21, 2023
1 parent 55bd6c3 commit ad29718
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions controllers/limitador_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,22 @@ func (r *LimitadorReconciler) reconcilePdb(ctx context.Context, limitadorObj *li
return err
}
if limitadorObj.Spec.PodDisruptionBudget == nil {
pdb := &policyv1.PodDisruptionBudget{}
if err := r.GetResource(ctx,
types.NamespacedName{
Namespace: limitadorObj.Namespace,
Name: limitador.PodDisruptionBudgetName(limitadorObj),
}, pdb); err != nil {
if errors.IsNotFound(err) {
return nil
}
return err
}
if pdb.ObjectMeta.DeletionTimestamp == nil {
if err = r.DeleteResource(ctx, pdb); err != nil {
return err
}
}
return nil
}

Expand Down

0 comments on commit ad29718

Please sign in to comment.