From ff7d131131b8404b8d0eef9dee9beb9b12bc2c24 Mon Sep 17 00:00:00 2001 From: Wen Zhou Date: Fri, 13 Sep 2024 19:22:21 +0200 Subject: [PATCH] feat: set DSCI application namespace to be immutable (#1222) - we do not support other values for now, this is to prevent user change to different value and cause old and new both running Signed-off-by: Wen Zhou --- apis/dscinitialization/v1/dscinitialization_types.go | 1 + .../dscinitialization.opendatahub.io_dscinitializations.yaml | 3 +++ .../dscinitialization.opendatahub.io_dscinitializations.yaml | 3 +++ 3 files changed, 7 insertions(+) diff --git a/apis/dscinitialization/v1/dscinitialization_types.go b/apis/dscinitialization/v1/dscinitialization_types.go index 7d71c52c995..e9598e89743 100644 --- a/apis/dscinitialization/v1/dscinitialization_types.go +++ b/apis/dscinitialization/v1/dscinitialization_types.go @@ -32,6 +32,7 @@ import ( type DSCInitializationSpec struct { // Namespace for applications to be installed, non-configurable, default to "opendatahub" // +kubebuilder:default:=opendatahub + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="ApplicationsNamespace is immutable" // +operator-sdk:csv:customresourcedefinitions:type=spec,order=1 ApplicationsNamespace string `json:"applicationsNamespace"` // Enable monitoring on specified namespace diff --git a/bundle/manifests/dscinitialization.opendatahub.io_dscinitializations.yaml b/bundle/manifests/dscinitialization.opendatahub.io_dscinitializations.yaml index 67798e35b0e..5cb7b2a2d2f 100644 --- a/bundle/manifests/dscinitialization.opendatahub.io_dscinitializations.yaml +++ b/bundle/manifests/dscinitialization.opendatahub.io_dscinitializations.yaml @@ -57,6 +57,9 @@ spec: description: Namespace for applications to be installed, non-configurable, default to "opendatahub" type: string + x-kubernetes-validations: + - message: ApplicationsNamespace is immutable + rule: self == oldSelf devFlags: description: |- Internal development useful field to test customizations. diff --git a/config/crd/bases/dscinitialization.opendatahub.io_dscinitializations.yaml b/config/crd/bases/dscinitialization.opendatahub.io_dscinitializations.yaml index 0833b65acb0..edacd9cf82e 100644 --- a/config/crd/bases/dscinitialization.opendatahub.io_dscinitializations.yaml +++ b/config/crd/bases/dscinitialization.opendatahub.io_dscinitializations.yaml @@ -57,6 +57,9 @@ spec: description: Namespace for applications to be installed, non-configurable, default to "opendatahub" type: string + x-kubernetes-validations: + - message: ApplicationsNamespace is immutable + rule: self == oldSelf devFlags: description: |- Internal development useful field to test customizations.