@@ -48,7 +48,7 @@ func (r *StatusReconciler) ReconcileStatus(ctx context.Context, object objectWit
4848 if err := r .reconcileCondition (ctx , object , r .getAvailableCondition (ctx , object .GetGeneration ())); err != nil {
4949 return err
5050 }
51- return r .reconcileCondition (ctx , object , r .getDependenciesFulfilledCondition (object . GetGeneration () ))
51+ return r .reconcileCondition (ctx , object , r .getDependenciesFulfilledCondition (ctx , object ))
5252}
5353
5454func (r * StatusReconciler ) reconcileCondition (ctx context.Context , object objectWithConditions , condition metav1.Condition ) error {
@@ -155,13 +155,36 @@ func (r *StatusReconciler) getAvailableCondition(ctx context.Context, gen int64)
155155 }
156156}
157157
158- func (r * StatusReconciler ) getDependenciesFulfilledCondition (gen int64 ) metav1.Condition {
158+ func (r * StatusReconciler ) getDependenciesFulfilledCondition (ctx context.Context , object objectWithConditions ) metav1.Condition {
159+ missingDependencies , err := r .deployable .HasMissingDependencies (ctx , r .Client , object .GetInternalObject ())
160+ if err != nil {
161+ return metav1.Condition {
162+ Type : string (kaiv1 .ConditionDependenciesFulfilled ),
163+ Status : metav1 .ConditionFalse ,
164+ Reason : string (kaiv1 .DependenciesMissing ),
165+ Message : err .Error (),
166+ ObservedGeneration : object .GetGeneration (),
167+ LastTransitionTime : metav1 .Now (),
168+ }
169+ }
170+
171+ if len (missingDependencies ) > 0 {
172+ return metav1.Condition {
173+ Type : string (kaiv1 .ConditionDependenciesFulfilled ),
174+ Status : metav1 .ConditionFalse ,
175+ Reason : string (kaiv1 .DependenciesMissing ),
176+ Message : missingDependencies ,
177+ ObservedGeneration : object .GetGeneration (),
178+ LastTransitionTime : metav1 .Now (),
179+ }
180+ }
181+
159182 return metav1.Condition {
160183 Type : string (kaiv1 .ConditionDependenciesFulfilled ),
161184 Status : metav1 .ConditionTrue ,
162185 Reason : string (kaiv1 .DependenciesFulfilled ),
163186 Message : "Dependencies are fulfilled" ,
164- ObservedGeneration : gen ,
187+ ObservedGeneration : object . GetGeneration () ,
165188 LastTransitionTime : metav1 .Now (),
166189 }
167190}
0 commit comments