diff --git a/pkg/reconciler/isbsvc/controller.go b/pkg/reconciler/isbsvc/controller.go index 7b04913d1..e1998f741 100644 --- a/pkg/reconciler/isbsvc/controller.go +++ b/pkg/reconciler/isbsvc/controller.go @@ -41,7 +41,9 @@ import ( ) const ( - finalizerName = dfv1.ControllerISBSvc + finalizerName = "numaflow.numaproj.io/" + dfv1.ControllerISBSvc + // TODO: clean up the deprecated finalizer in v1.7 + deprecatedFinalizerName = dfv1.ControllerISBSvc ) // interStepBufferReconciler reconciles an Inter-Step Buffer Service object. @@ -97,7 +99,7 @@ func (r *interStepBufferServiceReconciler) reconcile(ctx context.Context, isbSvc log := logging.FromContext(ctx) if !isbSvc.DeletionTimestamp.IsZero() { log.Info("Deleting ISB Service") - if controllerutil.ContainsFinalizer(isbSvc, finalizerName) { + if controllerutil.ContainsFinalizer(isbSvc, finalizerName) || controllerutil.ContainsFinalizer(isbSvc, deprecatedFinalizerName) { // Finalizer logic should be added here. if err := installer.Uninstall(ctx, isbSvc, r.client, r.kubeClient, r.config, log, r.recorder); err != nil { log.Errorw("Failed to uninstall", zap.Error(err)) @@ -105,11 +107,15 @@ func (r *interStepBufferServiceReconciler) reconcile(ctx context.Context, isbSvc return err } controllerutil.RemoveFinalizer(isbSvc, finalizerName) + controllerutil.RemoveFinalizer(isbSvc, deprecatedFinalizerName) // Clean up metrics _ = reconciler.ISBSvcHealth.DeleteLabelValues(isbSvc.Namespace, isbSvc.Name) } return nil } + if controllerutil.ContainsFinalizer(isbSvc, deprecatedFinalizerName) { // Remove deprecated finalizer if exists + controllerutil.RemoveFinalizer(isbSvc, deprecatedFinalizerName) + } if needsFinalizer(isbSvc) { controllerutil.AddFinalizer(isbSvc, finalizerName) } diff --git a/pkg/reconciler/pipeline/controller.go b/pkg/reconciler/pipeline/controller.go index cb7e7a2bf..8b7a7c8ad 100644 --- a/pkg/reconciler/pipeline/controller.go +++ b/pkg/reconciler/pipeline/controller.go @@ -52,7 +52,9 @@ import ( ) const ( - finalizerName = dfv1.ControllerPipeline + finalizerName = "numaflow.numaproj.io/" + dfv1.ControllerPipeline + // TODO: clean up the deprecated finalizer in v1.7 + deprecatedFinalizerName = dfv1.ControllerPipeline pauseTimestampPath = `/metadata/annotations/numaflow.numaproj.io~1pause-timestamp` ) @@ -111,7 +113,7 @@ func (r *pipelineReconciler) reconcile(ctx context.Context, pl *dfv1.Pipeline) ( log := logging.FromContext(ctx) if !pl.DeletionTimestamp.IsZero() { log.Info("Deleting pipeline") - if controllerutil.ContainsFinalizer(pl, finalizerName) { + if controllerutil.ContainsFinalizer(pl, finalizerName) || controllerutil.ContainsFinalizer(pl, deprecatedFinalizerName) { if time.Now().Before(pl.DeletionTimestamp.Add(time.Duration(pl.GetTerminationGracePeriodSeconds()) * time.Second)) { safeToDelete, err := r.safeToDelete(ctx, pl) if err != nil { @@ -135,6 +137,7 @@ func (r *pipelineReconciler) reconcile(ctx context.Context, pl *dfv1.Pipeline) ( } controllerutil.RemoveFinalizer(pl, finalizerName) + controllerutil.RemoveFinalizer(pl, deprecatedFinalizerName) // Clean up metrics _ = reconciler.PipelineHealth.DeleteLabelValues(pl.Namespace, pl.Name) // Delete corresponding vertex metrics @@ -155,6 +158,10 @@ func (r *pipelineReconciler) reconcile(ctx context.Context, pl *dfv1.Pipeline) ( pl.Status.InitConditions() pl.Status.SetObservedGeneration(pl.Generation) + if controllerutil.ContainsFinalizer(pl, deprecatedFinalizerName) { // Remove deprecated finalizer if exists + controllerutil.RemoveFinalizer(pl, deprecatedFinalizerName) + } + if !controllerutil.ContainsFinalizer(pl, finalizerName) { controllerutil.AddFinalizer(pl, finalizerName) }