From f6f51654daab3740bd186c53110c8bdfef1a1f42 Mon Sep 17 00:00:00 2001 From: zerospiel Date: Wed, 25 Sep 2024 13:19:40 +0200 Subject: [PATCH] Fix incorrect condition to enable CAPI --- internal/controller/management_controller.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/controller/management_controller.go b/internal/controller/management_controller.go index c189de638..2a264fcd6 100644 --- a/internal/controller/management_controller.go +++ b/internal/controller/management_controller.go @@ -309,9 +309,13 @@ func (r *ManagementReconciler) enableAdditionalComponents(ctx context.Context, m // Enable HMC capi operator only if it was not explicitly disabled in the config to // support installation with existing cluster api operator - if v, ok := capiOperatorValues["enabled"].(bool); ok && v { - l.Info("Enabling cluster API operator") - capiOperatorValues["enabled"] = true + { + enabledV, enabledExists := capiOperatorValues["enabled"] + enabledValue, castedOk := enabledV.(bool) + if !enabledExists || !castedOk || enabledValue { + l.Info("Enabling cluster API operator") + capiOperatorValues["enabled"] = true + } } config["cluster-api-operator"] = capiOperatorValues