@@ -266,26 +266,21 @@ func (r *AppWrapperReconciler) Reconcile(ctx context.Context, req ctrl.Request)
266
266
}
267
267
268
268
// Detect externally deleted components and transition to Failed with no GracePeriod or retry
269
+ detailMsg := fmt .Sprintf ("Only found %v deployed components, but was expecting %v" , compStatus .deployed , compStatus .expected )
269
270
if compStatus .deployed != compStatus .expected {
270
- // There may be a lag before created resources become visible in the cache; don't react too quickly.
271
- whenDeployed := meta .FindStatusCondition (aw .Status .Conditions , string (workloadv1beta2 .ResourcesDeployed )).LastTransitionTime
272
- graceDuration := r .admissionGraceDuration (ctx , aw )
273
- if time .Now ().After (whenDeployed .Add (graceDuration )) {
274
- detailMsg := fmt .Sprintf ("Only found %v deployed components, but was expecting %v" , compStatus .deployed , compStatus .expected )
275
- meta .SetStatusCondition (& aw .Status .Conditions , metav1.Condition {
276
- Type : string (workloadv1beta2 .Unhealthy ),
277
- Status : metav1 .ConditionTrue ,
278
- Reason : "MissingComponent" ,
279
- Message : detailMsg ,
280
- })
281
- r .Recorder .Event (aw , v1 .EventTypeNormal , string (workloadv1beta2 .Unhealthy ), "MissingComponent: " + detailMsg )
282
- return ctrl.Result {}, r .transitionToPhase (ctx , orig , aw , workloadv1beta2 .AppWrapperFailed )
283
- }
271
+ meta .SetStatusCondition (& aw .Status .Conditions , metav1.Condition {
272
+ Type : string (workloadv1beta2 .Unhealthy ),
273
+ Status : metav1 .ConditionTrue ,
274
+ Reason : "MissingComponent" ,
275
+ Message : detailMsg ,
276
+ })
277
+ r .Recorder .Event (aw , v1 .EventTypeNormal , string (workloadv1beta2 .Unhealthy ), "MissingComponent: " + detailMsg )
278
+ return ctrl.Result {}, r .transitionToPhase (ctx , orig , aw , workloadv1beta2 .AppWrapperFailed )
284
279
}
285
280
286
281
// If a component's controller has put it into a failed state, we do not need
287
282
// to allow a grace period. The situation will not self-correct.
288
- detailMsg : = fmt .Sprintf ("Found %v failed components" , compStatus .failed )
283
+ detailMsg = fmt .Sprintf ("Found %v failed components" , compStatus .failed )
289
284
if compStatus .failed > 0 {
290
285
meta .SetStatusCondition (& aw .Status .Conditions , metav1.Condition {
291
286
Type : string (workloadv1beta2 .Unhealthy ),
0 commit comments