From 3605aa0d4d529c510bb15b321c7179e5f9a97418 Mon Sep 17 00:00:00 2001 From: Janis Kemper Date: Tue, 21 May 2024 10:15:10 +0100 Subject: [PATCH] :bug: Fix reset of HelmChartStatus of ClusterAddon In the previous PR we introduced a bug that resets the status in every reconcile loop as long as a hook is specified. However, we only want to reset it once when the hook is new. This commit introduces the same. Signed-off-by: janiskemper --- internal/controller/clusteraddon_controller.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/controller/clusteraddon_controller.go b/internal/controller/clusteraddon_controller.go index 38ea515ba..faa96671c 100644 --- a/internal/controller/clusteraddon_controller.go +++ b/internal/controller/clusteraddon_controller.go @@ -306,7 +306,13 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re // if a hook is specified, we cannot be ready yet // if a hook is set, it is expected that HelmChartAppliedCondition is removed if clusterAddon.Spec.Hook != "" { - clusterAddon.Status.HelmChartStatus = make(map[string]csov1alpha1.HelmChartStatusConditions) + // if the clusterAddon was ready before, it means this hook is fresh and we have to reset the status + if clusterAddon.Status.Ready { + clusterAddon.Status.HelmChartStatus = make(map[string]csov1alpha1.HelmChartStatusConditions) + } + if clusterAddon.Status.HelmChartStatus == nil { + clusterAddon.Status.HelmChartStatus = make(map[string]csov1alpha1.HelmChartStatusConditions) + } clusterAddon.Status.Ready = false }