From d0725888b6506826320cc70809d7f8478f9ca028 Mon Sep 17 00:00:00 2001 From: Quentin Barrand Date: Thu, 28 Mar 2024 16:08:19 +0100 Subject: [PATCH] PreflightValidation: populate old status keys (#1068) Also populate old-style, un-namespaced status keys to remain compatible with clients designed for pre-2.1 KMM. Upstream-Commit: 3a87a9c6876fdc4304254e567ba311a1e50ab171 --- api/v1beta1/preflightvalidation_types.go | 3 +++ api/v1beta1/preflightvalidation_types_test.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/api/v1beta1/preflightvalidation_types.go b/api/v1beta1/preflightvalidation_types.go index d9cd25ed2..394600be4 100644 --- a/api/v1beta1/preflightvalidation_types.go +++ b/api/v1beta1/preflightvalidation_types.go @@ -123,6 +123,9 @@ func v1beta1StatusFromV1beta2(s v1beta2.PreflightValidationStatus) PreflightVali for _, v := range s.Modules { v := v res.CRStatuses[v.Namespace+"/"+v.Name] = &v.CRBaseStatus + + // This may lead to collisions, but at least we preserve backwards compatibility. + res.CRStatuses[v.Name] = &v.CRBaseStatus } } diff --git a/api/v1beta1/preflightvalidation_types_test.go b/api/v1beta1/preflightvalidation_types_test.go index 68b487ec7..2498563b8 100644 --- a/api/v1beta1/preflightvalidation_types_test.go +++ b/api/v1beta1/preflightvalidation_types_test.go @@ -54,7 +54,9 @@ var _ = Describe("PreflightValidation_ConvertFrom", func() { Status: PreflightValidationStatus{ CRStatuses: map[string]*CRStatus{ "namespace-1/module-1": &baseStatus1, + "module-1": &baseStatus1, "namespace-2/module-2": &baseStatus2, + "module-2": &baseStatus2, }, }, }