Skip to content

Commit ad29718

Browse files
Handle PDB deletion
Co-authored-by: Grzegorz Piotrowski <[email protected]>
1 parent 55bd6c3 commit ad29718

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

controllers/limitador_controller.go

+16
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,22 @@ func (r *LimitadorReconciler) reconcilePdb(ctx context.Context, limitadorObj *li
131131
return err
132132
}
133133
if limitadorObj.Spec.PodDisruptionBudget == nil {
134+
pdb := &policyv1.PodDisruptionBudget{}
135+
if err := r.GetResource(ctx,
136+
types.NamespacedName{
137+
Namespace: limitadorObj.Namespace,
138+
Name: limitador.PodDisruptionBudgetName(limitadorObj),
139+
}, pdb); err != nil {
140+
if errors.IsNotFound(err) {
141+
return nil
142+
}
143+
return err
144+
}
145+
if pdb.ObjectMeta.DeletionTimestamp == nil {
146+
if err = r.DeleteResource(ctx, pdb); err != nil {
147+
return err
148+
}
149+
}
134150
return nil
135151
}
136152

0 commit comments

Comments
 (0)