@@ -41,11 +41,6 @@ func (r *Reconciler) Sync(ctx context.Context, cr *v1alpha1.Storage) (ctrl.Resul
4141 return result , err
4242 }
4343
44- stop , result , err = r .syncNodeSetSpecInline (ctx , & storage )
45- if stop {
46- return result , err
47- }
48-
4944 if ! meta .IsStatusConditionTrue (storage .Status .Conditions , StorageInitializedCondition ) {
5045 return r .handleBlobstorageInit (ctx , & storage )
5146 }
@@ -400,6 +395,17 @@ func (r *Reconciler) handleResourcesSync(
400395 }
401396 }
402397
398+ if err := r .syncNodeSetSpecInline (ctx , storage ); err != nil {
399+ meta .SetStatusCondition (& storage .Status .Conditions , metav1.Condition {
400+ Type : StoragePreparedCondition ,
401+ Status : metav1 .ConditionFalse ,
402+ Reason : ReasonInProgress ,
403+ ObservedGeneration : storage .Generation ,
404+ Message : "Failed to sync NodeSet resources" ,
405+ })
406+ return r .updateStatus (ctx , storage , DefaultRequeueDelay )
407+ }
408+
403409 if ! meta .IsStatusConditionTrue (storage .Status .Conditions , StoragePreparedCondition ) {
404410 meta .SetStatusCondition (& storage .Status .Conditions , metav1.Condition {
405411 Type : StoragePreparedCondition ,
@@ -418,8 +424,7 @@ func (r *Reconciler) handleResourcesSync(
418424func (r * Reconciler ) syncNodeSetSpecInline (
419425 ctx context.Context ,
420426 storage * resources.StorageClusterBuilder ,
421- ) (bool , ctrl.Result , error ) {
422- r .Log .Info ("running step syncNodeSetSpecInline" )
427+ ) error {
423428 matchingFields := client.MatchingFields {
424429 OwnerControllerField : storage .Name ,
425430 }
@@ -435,7 +440,7 @@ func (r *Reconciler) syncNodeSetSpecInline(
435440 "ProvisioningFailed" ,
436441 fmt .Sprintf ("Failed to list StorageNodeSets: %s" , err ),
437442 )
438- return Stop , ctrl. Result { RequeueAfter : DefaultRequeueDelay }, err
443+ return err
439444 }
440445
441446 for _ , storageNodeSet := range storageNodeSets .Items {
@@ -459,7 +464,7 @@ func (r *Reconciler) syncNodeSetSpecInline(
459464 "ProvisioningFailed" ,
460465 fmt .Sprintf ("Failed to delete StorageNodeSet: %s" , err ),
461466 )
462- return Stop , ctrl. Result { RequeueAfter : DefaultRequeueDelay }, err
467+ return err
463468 }
464469 r .Recorder .Event (
465470 storage ,
@@ -484,7 +489,7 @@ func (r *Reconciler) syncNodeSetSpecInline(
484489 "ProvisioningFailed" ,
485490 fmt .Sprintf ("Failed to list RemoteStorageNodeSets: %s" , err ),
486491 )
487- return Stop , ctrl. Result { RequeueAfter : DefaultRequeueDelay }, err
492+ return err
488493 }
489494
490495 for _ , remoteStorageNodeSet := range remoteStorageNodeSets .Items {
@@ -508,7 +513,7 @@ func (r *Reconciler) syncNodeSetSpecInline(
508513 "ProvisioningFailed" ,
509514 fmt .Sprintf ("Failed to delete RemoteStorageNodeSet: %s" , err ),
510515 )
511- return Stop , ctrl. Result { RequeueAfter : DefaultRequeueDelay }, err
516+ return err
512517 }
513518 r .Recorder .Event (
514519 storage ,
@@ -522,19 +527,7 @@ func (r *Reconciler) syncNodeSetSpecInline(
522527 }
523528 }
524529
525- if ! meta .IsStatusConditionTrue (storage .Status .Conditions , StoragePreparedCondition ) {
526- meta .SetStatusCondition (& storage .Status .Conditions , metav1.Condition {
527- Type : StoragePreparedCondition ,
528- Status : metav1 .ConditionTrue ,
529- Reason : ReasonCompleted ,
530- ObservedGeneration : storage .Generation ,
531- Message : "Successfully synced resources" ,
532- })
533- return r .updateStatus (ctx , storage , StatusUpdateRequeueDelay )
534- }
535-
536- r .Log .Info ("complete step syncNodeSetSpecInline" )
537- return Continue , ctrl.Result {Requeue : false }, nil
530+ return nil
538531}
539532
540533func (r * Reconciler ) runSelfCheck (
0 commit comments