Skip to content

Commit c3054ae

Browse files
committed
[DNSMasq]Check delete before creating ServiceAccount
When the namespace is deleted ServiceAccount creation will fail and because that runs before checking if the DNSMasq is being deleted too the DNSMasq will never be deleted. This patch moves the check before the SA creation. Fixes: OSP-27793
1 parent 5c4fd28 commit c3054ae

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

controllers/network/dnsmasq_controller.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ func (r *DNSMasqReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
165165
instance.Status.Hash = map[string]string{}
166166
}
167167

168+
// Handle service delete
169+
if !instance.DeletionTimestamp.IsZero() {
170+
return r.reconcileDelete(ctx, instance, helper)
171+
}
172+
168173
// Service account, role, binding
169174
rbacRules := []rbacv1.PolicyRule{
170175
{
@@ -186,11 +191,6 @@ func (r *DNSMasqReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
186191
return rbacResult, nil
187192
}
188193

189-
// Handle service delete
190-
if !instance.DeletionTimestamp.IsZero() {
191-
return r.reconcileDelete(ctx, instance, helper)
192-
}
193-
194194
// Handle non-deleted clusters
195195
return r.reconcileNormal(ctx, instance, helper)
196196
}

0 commit comments

Comments
 (0)