@@ -39,6 +39,7 @@ const (
3939 helmReleaseName = "tenant-resources"
4040
4141 managedServicesAnnotation = "platform.stackrox.io/managed-services"
42+ pauseReconcileAnnotation = "stackrox.io/pause-reconcile"
4243 envAnnotationKey = "rhacs.redhat.com/environment"
4344 clusterNameAnnotationKey = "rhacs.redhat.com/cluster-name"
4445 orgNameAnnotationKey = "rhacs.redhat.com/org-name"
@@ -722,13 +723,38 @@ func (r *CentralReconciler) ensureCentralCRDeleted(ctx context.Context, central
722723
723724 return false , errors .Wrapf (err , "delete central CR %s/%s" , central .GetNamespace (), central .GetName ())
724725 }
726+
727+ // avoid being stuck in a deprovisioning state due to the pause reconcile annotation
728+ err = r .disablePauseReconcileIfPresent (ctx , central )
729+ if err != nil {
730+ return false , err
731+ }
732+
725733 if err := r .client .Delete (ctx , central ); err != nil {
726734 return false , errors .Wrapf (err , "delete central CR %s/%s" , central .GetNamespace (), central .GetName ())
727735 }
728736 glog .Infof ("Central CR %s/%s is marked for deletion" , central .GetNamespace (), central .GetName ())
729737 return false , nil
730738}
731739
740+ func (r * CentralReconciler ) disablePauseReconcileIfPresent (ctx context.Context , central * v1alpha1.Central ) error {
741+ if central .Annotations == nil {
742+ return nil
743+ }
744+
745+ if value , exists := central .Annotations [pauseReconcileAnnotation ]; ! exists || value != "true" {
746+ return nil
747+ }
748+
749+ central .Annotations [pauseReconcileAnnotation ] = "false"
750+ err := r .client .Update (ctx , central )
751+ if err != nil {
752+ return fmt .Errorf ("removing pause reconcile annotation: %v" , err )
753+ }
754+
755+ return nil
756+ }
757+
732758func (r * CentralReconciler ) ensureChartResourcesExist (ctx context.Context , remoteCentral private.ManagedCentral ) error {
733759 vals , err := r .chartValues (remoteCentral )
734760 if err != nil {
0 commit comments