Skip to content

Commit d74e76a

Browse files
committed
🐛 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 <[email protected]>
1 parent 201e62d commit d74e76a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/controller/clusteraddon_controller.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,13 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re
306306
// if a hook is specified, we cannot be ready yet
307307
// if a hook is set, it is expected that HelmChartAppliedCondition is removed
308308
if clusterAddon.Spec.Hook != "" {
309-
clusterAddon.Status.HelmChartStatus = make(map[string]csov1alpha1.HelmChartStatusConditions)
309+
// if the clusterAddon was ready before, it means this hook is fresh and we have to reset the status
310+
if clusterAddon.Status.Ready {
311+
clusterAddon.Status.HelmChartStatus = make(map[string]csov1alpha1.HelmChartStatusConditions)
312+
}
313+
if clusterAddon.Status.HelmChartStatus == nil {
314+
clusterAddon.Status.HelmChartStatus = make(map[string]csov1alpha1.HelmChartStatusConditions)
315+
}
310316
clusterAddon.Status.Ready = false
311317
}
312318

0 commit comments

Comments
 (0)