@@ -125,9 +125,12 @@ func (r *CommonServiceReconciler) ReconcileMasterCR(ctx context.Context, instanc
125125 } else {
126126 instance .SetReadyCondition (constant .KindCR , apiv3 .ConditionTypeReady , corev1 .ConditionTrue )
127127 }
128- if err := r .Client .Status ().Update (ctx , instance ); err != nil {
129- klog .Warning (err )
130- return
128+ // block status update
129+ if os .Getenv ("NO_OLM" ) != "true" {
130+ if err := r .Client .Status ().Update (ctx , instance ); err != nil {
131+ klog .Warning (err )
132+ return
133+ }
131134 }
132135 }()
133136
@@ -145,9 +148,11 @@ func (r *CommonServiceReconciler) ReconcileMasterCR(ctx context.Context, instanc
145148 if ! reflect .DeepEqual (originalInstance .Status , instance .Status ) {
146149 forceUpdateODLMCRs = true
147150 }
148-
149- if statusErr = r .Client .Status ().Patch (ctx , instance , client .MergeFrom (originalInstance )); statusErr != nil {
150- return ctrl.Result {}, fmt .Errorf ("error while patching CommonService.Status: %v" , statusErr )
151+ // block status update
152+ if os .Getenv ("NO_OLM" ) != "true" {
153+ if statusErr = r .Client .Status ().Patch (ctx , instance , client .MergeFrom (originalInstance )); statusErr != nil {
154+ return ctrl.Result {}, fmt .Errorf ("error while patching CommonService.Status: %v" , statusErr )
155+ }
151156 }
152157
153158 if instance .Status .Phase == "" {
@@ -159,9 +164,12 @@ func (r *CommonServiceReconciler) ReconcileMasterCR(ctx context.Context, instanc
159164 return ctrl.Result {}, statusErr
160165 }
161166 } else {
162- if statusErr = r .updatePhase (ctx , instance , CRUpdating ); statusErr != nil {
163- klog .Errorf ("Fail to reconcile %s/%s: %v" , instance .Namespace , instance .Name , statusErr )
164- return ctrl.Result {}, statusErr
167+ // block status update
168+ if os .Getenv ("NO_OLM" ) != "true" {
169+ if statusErr = r .updatePhase (ctx , instance , CRUpdating ); statusErr != nil {
170+ klog .Errorf ("Fail to reconcile %s/%s: %v" , instance .Namespace , instance .Name , statusErr )
171+ return ctrl.Result {}, statusErr
172+ }
165173 }
166174 }
167175
@@ -203,8 +211,11 @@ func (r *CommonServiceReconciler) ReconcileMasterCR(ctx context.Context, instanc
203211 if err := r .Reader .Get (ctx , types.NamespacedName {Name : r .Bootstrap .CSData .ServicesNs }, ns ); err != nil {
204212 if errors .IsNotFound (err ) {
205213 klog .Errorf ("Not found servicesNamespace %s specified in the common-service CR." , r .Bootstrap .CSData .ServicesNs )
206- if err := r .updatePhase (ctx , instance , CRFailed ); err != nil {
207- klog .Error (err )
214+ // block status update
215+ if os .Getenv ("NO_OLM" ) != "true" {
216+ if err := r .updatePhase (ctx , instance , CRFailed ); err != nil {
217+ klog .Error (err )
218+ }
208219 }
209220 klog .Errorf ("Fail to reconcile %s/%s: %v" , instance .Namespace , instance .Name , err )
210221 return ctrl.Result {}, err
@@ -267,10 +278,12 @@ func (r *CommonServiceReconciler) ReconcileMasterCR(ctx context.Context, instanc
267278 instance .SetErrorCondition (constant .MasterCR , apiv3 .ConditionTypeError , corev1 .ConditionTrue , apiv3 .ConditionReasonError , statusErr .Error ())
268279 instance .Status .Phase = CRFailed
269280 }
270-
271- if statusErr = r .Client .Status ().Update (ctx , instance ); statusErr != nil {
272- klog .Errorf ("Fail to update %s/%s: %v" , instance .Namespace , instance .Name , statusErr )
273- return ctrl.Result {}, statusErr
281+ // block status update
282+ if os .Getenv ("NO_OLM" ) != "true" {
283+ if statusErr = r .Client .Status ().Update (ctx , instance ); statusErr != nil {
284+ klog .Errorf ("Fail to update %s/%s: %v" , instance .Namespace , instance .Name , statusErr )
285+ return ctrl.Result {}, statusErr
286+ }
274287 }
275288
276289 var isEqual bool
0 commit comments