@@ -170,20 +170,7 @@ func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Reques
170170
171171 // Finalise the reconciliation and report the results.
172172 defer func () {
173- // Set the value of the reconciliation request in status.
174- if v , ok := meta .ReconcileAnnotationValue (obj .GetAnnotations ()); ok {
175- obj .Status .LastHandledReconcileAt = v
176- }
177-
178- // Remove the Reconciling condition and update the observed generation
179- // if the reconciliation was successful.
180- if conditions .IsTrue (obj , meta .ReadyCondition ) {
181- conditions .Delete (obj , meta .ReconcilingCondition )
182- obj .Status .ObservedGeneration = obj .Generation
183- }
184-
185- // Patch metadata, status and conditions.
186- retErr = r .patch (ctx , obj , patcher )
173+ retErr = r .finalizeStatus (ctx , obj , patcher )
187174
188175 // Record Prometheus metrics.
189176 r .Metrics .RecordReadiness (ctx , obj )
@@ -221,7 +208,7 @@ func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Reques
221208
222209 // Set reconciling condition.
223210 if obj .Generation != obj .Status .ObservedGeneration {
224- conditions .MarkReconciling (obj , "NewGeneration" , "Reconciling new object generation (%d)" , obj .Generation )
211+ conditions .MarkReconciling (obj , meta . ProgressingReason , "Reconciling new object generation (%d)" , obj .Generation )
225212 }
226213
227214 // Resolve the source reference and requeue the reconciliation if the source is not found.
@@ -465,7 +452,7 @@ func (r *KustomizationReconciler) checkDependencies(ctx context.Context,
465452 var k kustomizev1.Kustomization
466453 err := r .Get (ctx , dName , & k )
467454 if err != nil {
468- return fmt .Errorf ("unable to get '%s' dependency : %w" , dName , err )
455+ return fmt .Errorf ("dependency '%s' not found : %w" , dName , err )
469456 }
470457
471458 if len (k .Status .Conditions ) == 0 || k .Generation != k .Status .ObservedGeneration {
@@ -480,7 +467,7 @@ func (r *KustomizationReconciler) checkDependencies(ctx context.Context,
480467 k .Spec .SourceRef .Namespace == obj .Spec .SourceRef .Namespace &&
481468 k .Spec .SourceRef .Kind == obj .Spec .SourceRef .Kind &&
482469 source .GetArtifact ().Revision != k .Status .LastAppliedRevision {
483- return fmt .Errorf ("dependency '%s' is not updated yet " , dName )
470+ return fmt .Errorf ("dependency '%s' revision is not up to date " , dName )
484471 }
485472 }
486473
@@ -979,6 +966,34 @@ func (r *KustomizationReconciler) event(obj *kustomizev1.Kustomization,
979966 r .EventRecorder .AnnotatedEventf (obj , metadata , eventtype , reason , msg )
980967}
981968
969+ func (r * KustomizationReconciler ) finalizeStatus (ctx context.Context ,
970+ obj * kustomizev1.Kustomization ,
971+ patcher * patch.SerialPatcher ) error {
972+ // Set the value of the reconciliation request in status.
973+ if v , ok := meta .ReconcileAnnotationValue (obj .GetAnnotations ()); ok {
974+ obj .Status .LastHandledReconcileAt = v
975+ }
976+
977+ // Remove the Reconciling condition and update the observed generation
978+ // if the reconciliation was successful.
979+ if conditions .IsTrue (obj , meta .ReadyCondition ) {
980+ conditions .Delete (obj , meta .ReconcilingCondition )
981+ obj .Status .ObservedGeneration = obj .Generation
982+ }
983+
984+ // Set the Reconciling reason to ProgressingWithRetry if the
985+ // reconciliation has failed.
986+ if conditions .IsFalse (obj , meta .ReadyCondition ) &&
987+ conditions .Has (obj , meta .ReconcilingCondition ) {
988+ rc := conditions .Get (obj , meta .ReconcilingCondition )
989+ rc .Reason = kustomizev1 .ProgressingWithRetryReason
990+ conditions .Set (obj , rc )
991+ }
992+
993+ // Patch metadata, status and conditions.
994+ return r .patch (ctx , obj , patcher )
995+ }
996+
982997func (r * KustomizationReconciler ) patch (ctx context.Context ,
983998 obj * kustomizev1.Kustomization ,
984999 patcher * patch.SerialPatcher ) (retErr error ) {
0 commit comments