From 41f1593cb96fe94ea2a28f61c472e1f391054c65 Mon Sep 17 00:00:00 2001 From: Joe Lanford Date: Mon, 24 Jun 2024 02:08:35 -0400 Subject: [PATCH] fix: make installNamespace immutable (#966) Signed-off-by: Joe Lanford --- api/v1alpha1/clusterextension_types.go | 1 + .../crd/bases/olm.operatorframework.io_clusterextensions.yaml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/api/v1alpha1/clusterextension_types.go b/api/v1alpha1/clusterextension_types.go index 907e762d1..e18ff68a4 100644 --- a/api/v1alpha1/clusterextension_types.go +++ b/api/v1alpha1/clusterextension_types.go @@ -73,6 +73,7 @@ type ClusterExtensionSpec struct { //+kubebuilder:validation:Pattern:=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ //+kubebuilder:validation:MaxLength:=63 + //+kubebuilder:validation:XValidation:rule="self == oldSelf",message="installNamespace is immutable" // // installNamespace is the namespace where the bundle should be installed. However, note that // the bundle may contain resources that are cluster-scoped or that are diff --git a/config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml b/config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml index 9c41127f5..f1da4ae8a 100644 --- a/config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml +++ b/config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml @@ -52,6 +52,9 @@ spec: maxLength: 63 pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ type: string + x-kubernetes-validations: + - message: installNamespace is immutable + rule: self == oldSelf packageName: maxLength: 48 pattern: ^[a-z0-9]+(-[a-z0-9]+)*$