Skip to content

Commit 0110ff9

Browse files
committed
operator: Move AllZero check after StatefulSet deletion during teardown
When a StretchCluster was being torn down, the AllZero() early return at the top of reconcileDecommission exited before reaching the ToDelete() loop. StatefulSets with zero replicas were never deleted, which blocked their owning NodePool custom resources from being garbage collected. Move the AllZero check after the scale-down and StatefulSet deletion logic so that zero-replica sets are cleaned up before the function returns.
1 parent 4eee6bf commit 0110ff9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

operator/internal/controller/redpanda/nodepool_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ func (r *NodePoolReconciler) Reconcile(ctx context.Context, req mcreconcile.Requ
213213

214214
// Examine if the object is under deletion
215215
if !pool.ObjectMeta.DeletionTimestamp.IsZero() {
216+
logger.V(log.TraceLevel).Info("deleting finalizer")
216217
if controllerutil.RemoveFinalizer(pool, FinalizerKey) {
217218
if err := k8sClient.Update(ctx, pool); err != nil {
218219
logger.Error(err, "updating cluster finalizer")
@@ -228,6 +229,7 @@ func (r *NodePoolReconciler) Reconcile(ctx context.Context, req mcreconcile.Requ
228229
// If any changes are made, persist the changes and immediately requeue to
229230
// prevent any cache / resource version synchronization issues.
230231
if controllerutil.AddFinalizer(pool, FinalizerKey) || feature.SetDefaults(ctx, feature.V2Flags, pool) {
232+
logger.V(log.TraceLevel).Info("adding finalizer")
231233
if err := k8sClient.Update(ctx, pool); err != nil {
232234
logger.Error(err, "updating cluster finalizer or Annotation")
233235
return ignoreConflict(err)

0 commit comments

Comments
 (0)