From 105b9a0d0213ec3232f2a5835dcc53e0204423f2 Mon Sep 17 00:00:00 2001 From: Lukas Piwowarski Date: Tue, 3 Feb 2026 18:58:03 +0100 Subject: [PATCH 1/3] Update KUTTL assertion to check overallStatus Replace the Reconciled condition check with overallStatus: Ready in the OpenStackLightspeed instance assertion. This aligns the test with the updated status section (recent OLS operator release). --- .../assert-openstack-lightspeed-instance.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml b/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml index e57cefb6..a0eee232 100644 --- a/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml +++ b/test/kuttl/common/openstack-lightspeed-instance/assert-openstack-lightspeed-instance.yaml @@ -96,9 +96,7 @@ status: - type: ApiReady status: "True" reason: Available - - type: Reconciled - status: "True" - reason: Available + overallStatus: Ready --- apiVersion: lightspeed.openstack.org/v1beta1 kind: OpenStackLightspeed From 57d84fcf1f282eeccd4942f2532a1e71753da526 Mon Sep 17 00:00:00 2001 From: Lukas Piwowarski Date: Tue, 3 Feb 2026 19:00:53 +0100 Subject: [PATCH 2/3] Use overallStatus field from OLSConfig Simplify IsOLSConfigReady by checking the new overallStatus field instead of iterating over individual conditions. This field is set to Ready when the OLS deployment completes successfully. --- internal/controller/funcs.go | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/internal/controller/funcs.go b/internal/controller/funcs.go index a0431b8b..f8832a6a 100644 --- a/internal/controller/funcs.go +++ b/internal/controller/funcs.go @@ -18,7 +18,6 @@ package controller import ( "context" - "encoding/json" "fmt" "math/rand" "strconv" @@ -267,36 +266,20 @@ func PatchOLSConfig( return nil } -// IsOLSConfigReady returns true if required conditions are true for OLSConfig +// IsOLSConfigReady returns true if OLSConfig's overallStatus is Ready func IsOLSConfigReady(ctx context.Context, helper *common_helper.Helper) (bool, error) { olsConfig, err := GetOLSConfig(ctx, helper) if err != nil { return false, err } - olsConfigStatusList, found, err := uns.NestedSlice(olsConfig.Object, "status", "conditions") - if !found { - return false, err - } - - jsonData, err := json.Marshal(olsConfigStatusList) - if err != nil { - return false, fmt.Errorf("failed to marshal OLSConfig status: %w", err) - } - - var OLSConfigConditions []metav1.Condition - err = json.Unmarshal(jsonData, &OLSConfigConditions) + overallStatus, found, err := uns.NestedString(olsConfig.Object, "status", "overallStatus") if err != nil { - return false, fmt.Errorf("failed to unmarshal JSON containing condition.Conditions: %w", err) + return false, err } - requiredConditionTypes := []string{"ConsolePluginReady", "CacheReady", "ApiReady", "Reconciled"} - for _, OLSConfigCondition := range OLSConfigConditions { - for _, requiredConditionType := range requiredConditionTypes { - if OLSConfigCondition.Type == requiredConditionType && OLSConfigCondition.Status != metav1.ConditionTrue { - return false, OLSConfigPing(ctx, helper) - } - } + if !found || overallStatus != "Ready" { + return false, OLSConfigPing(ctx, helper) } return true, nil From b334dd0a236424ac221860fac1948ce2460eea9e Mon Sep 17 00:00:00 2001 From: Lukas Piwowarski Date: Wed, 4 Feb 2026 14:09:53 +0100 Subject: [PATCH 3/3] Fix RemoveOLSConfig to wait for actual deletion After calling Delete(), the function now verifies that the OLSConfig is actually deleted by checking if GetOLSConfig returns NotFound. This prevents a race condition where RemoveOLSConfig would return true while the resource was still in Terminating state (due to the lightspeed-operator's finalizer), causing the controller to proceed with uninstalling the OLS operator before it could remove its own finalizer. This commit introduced the finalizer on the OLS side [1]. [1] https://github.com/openshift/lightspeed-operator/commit/5571e5866849bdb76c5ecdab9e1ff9b8a193fb89 --- internal/controller/funcs.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/controller/funcs.go b/internal/controller/funcs.go index f8832a6a..c5e38de6 100644 --- a/internal/controller/funcs.go +++ b/internal/controller/funcs.go @@ -109,7 +109,14 @@ func RemoveOLSConfig( return false, err } - return true, nil + _, err = GetOLSConfig(ctx, helper) + if err != nil && k8s_errors.IsNotFound(err) { + return true, nil + } else if err != nil { + return false, err + } + + return false, nil } // GetOLSConfig returns OLSConfig if there is one present in the cluster.