From cb9d68a2f8d047901005863f9827d0a61a48f670 Mon Sep 17 00:00:00 2001 From: Cavaughn Browne Date: Fri, 1 Dec 2023 22:04:21 +0000 Subject: [PATCH] consider default cni status in ready condition except for when skip upgrades reason --- controllers/cluster_controller.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/controllers/cluster_controller.go b/controllers/cluster_controller.go index c99ebc47012b..b0d91aab2f74 100644 --- a/controllers/cluster_controller.go +++ b/controllers/cluster_controller.go @@ -437,13 +437,23 @@ func (r *ClusterReconciler) updateStatus(ctx context.Context, log logr.Logger, c clusters.UpdateClusterStatusForCNI(ctx, cluster) + summarizedConditionTypes := []anywherev1.ConditionType{ + anywherev1.ControlPlaneInitializedCondition, + anywherev1.ControlPlaneReadyCondition, + anywherev1.WorkersReadyCondition, + } + + defaultCNIConfiguredCondition := conditions.Get(cluster, anywherev1.DefaultCNIConfiguredCondition) + if defaultCNIConfiguredCondition == nil || + (defaultCNIConfiguredCondition != nil && + defaultCNIConfiguredCondition.Status == "False" && + defaultCNIConfiguredCondition.Reason != anywherev1.SkipUpgradesForDefaultCNIConfiguredReason) { + summarizedConditionTypes = append(summarizedConditionTypes, anywherev1.DefaultCNIConfiguredCondition) + } + // Always update the readyCondition by summarizing the state of other conditions. conditions.SetSummary(cluster, - conditions.WithConditions( - anywherev1.ControlPlaneInitializedCondition, - anywherev1.ControlPlaneReadyCondition, - anywherev1.WorkersReadyCondition, - ), + conditions.WithConditions(summarizedConditionTypes...), ) return nil