Skip to content

Commit fda98df

Browse files
committed
ESO-49: Updates ExternalSecrets API to make operand namespace config immutable
1 parent 0dabaa6 commit fda98df

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

api/v1alpha1/external_secrets_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@ type ExternalSecretsConfig struct {
120120

121121
// ControllerConfig is for configuring the operator for setting up
122122
// defaults to install external-secrets.
123+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.namespace) && !has(self.namespace) || has(oldSelf.namespace) && has(self.namespace)",message="namespace may only be configured during creation"
123124
type ControllerConfig struct {
124125
// namespace is for configuring the namespace to install the external-secret operand.
125126
// +kubebuilder:validation:Optional
126127
// +kubebuilder:default:="external-secrets"
128+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="namespace is immutable once set"
127129
Namespace string `json:"namespace,omitempty"`
128130

129131
// labels to apply to all resources created for external-secrets deployment.

bundle/manifests/operator.openshift.io_externalsecrets.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ spec:
6363
description: namespace is for configuring the namespace to install
6464
the external-secret operand.
6565
type: string
66+
x-kubernetes-validations:
67+
- message: namespace is immutable once set
68+
rule: self == oldSelf
6669
type: object
70+
x-kubernetes-validations:
71+
- message: namespace may only be configured during creation
72+
rule: '!has(oldSelf.namespace) && !has(self.namespace) || has(oldSelf.namespace)
73+
&& has(self.namespace)'
6774
externalSecretsConfig:
6875
description: externalSecretsConfig is for configuring the external-secrets
6976
behavior.

config/crd/bases/operator.openshift.io_externalsecrets.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ spec:
6363
description: namespace is for configuring the namespace to install
6464
the external-secret operand.
6565
type: string
66+
x-kubernetes-validations:
67+
- message: namespace is immutable once set
68+
rule: self == oldSelf
6669
type: object
70+
x-kubernetes-validations:
71+
- message: namespace may only be configured during creation
72+
rule: '!has(oldSelf.namespace) && !has(self.namespace) || has(oldSelf.namespace)
73+
&& has(self.namespace)'
6774
externalSecretsConfig:
6875
description: externalSecretsConfig is for configuring the external-secrets
6976
behavior.

0 commit comments

Comments
 (0)