@@ -294,10 +294,6 @@ func verifyBDStatus(dep *rukpakv1alpha1.BundleDeployment) (metav1.ConditionStatu
294
294
isValidBundleCond := apimeta .FindStatusCondition (dep .Status .Conditions , rukpakv1alpha1 .TypeHasValidBundle )
295
295
isInstalledCond := apimeta .FindStatusCondition (dep .Status .Conditions , rukpakv1alpha1 .TypeInstalled )
296
296
297
- if isValidBundleCond == nil && isInstalledCond == nil {
298
- return metav1 .ConditionUnknown , fmt .Sprintf ("waiting for bundleDeployment %q status to be updated" , dep .Name )
299
- }
300
-
301
297
if isValidBundleCond != nil && isValidBundleCond .Status == metav1 .ConditionFalse {
302
298
return metav1 .ConditionFalse , isValidBundleCond .Message
303
299
}
@@ -309,11 +305,21 @@ func verifyBDStatus(dep *rukpakv1alpha1.BundleDeployment) (metav1.ConditionStatu
309
305
if isInstalledCond != nil && isInstalledCond .Status == metav1 .ConditionTrue {
310
306
return metav1 .ConditionTrue , "install was successful"
311
307
}
312
- return metav1 .ConditionUnknown , fmt .Sprintf ("could not determine the state of bundleDeployment %s" , dep .Name )
308
+ return metav1 .ConditionUnknown , fmt .Sprintf ("could not determine the state of BundleDeployment %s" , dep .Name )
313
309
}
314
310
315
311
// mapBDStatusToReadyCondition returns the operator object's "TypeReady" condition based on the bundle deployment statuses.
316
312
func mapBDStatusToReadyCondition (existingBD * rukpakv1alpha1.BundleDeployment , observedGeneration int64 ) metav1.Condition {
313
+ // if BundleDeployment status is stale, return an unknown condition.
314
+ if isBundleDepStale (existingBD ) {
315
+ return metav1.Condition {
316
+ Type : operatorsv1alpha1 .TypeReady ,
317
+ Status : metav1 .ConditionUnknown ,
318
+ Reason : operatorsv1alpha1 .ReasonInstallationStatusUnknown ,
319
+ Message : fmt .Sprintf ("waiting for BundleDeployment %q status to be updated. BundleDeployment conditions out of date." , existingBD .Name ),
320
+ ObservedGeneration : observedGeneration ,
321
+ }
322
+ }
317
323
// update operator status:
318
324
// 1. If the Operator "Ready" status is "Unknown": The status of successful bundleDeployment is unknown, wait till Rukpak updates the BD status.
319
325
// 2. If the Operator "Ready" status is "True": Update the "successful resolution" status and return the result.
@@ -338,3 +344,8 @@ func mapBDStatusToReadyCondition(existingBD *rukpakv1alpha1.BundleDeployment, ob
338
344
ObservedGeneration : observedGeneration ,
339
345
}
340
346
}
347
+
348
+ // isBundleDepStale returns true if conditions are out of date.
349
+ func isBundleDepStale (bd * rukpakv1alpha1.BundleDeployment ) bool {
350
+ return bd != nil && bd .Status .ObservedGeneration != bd .GetGeneration ()
351
+ }
0 commit comments