Skip to content

Commit

Permalink
networkfence: make secret as immutable
Browse files Browse the repository at this point in the history
mark secret as immutable once created
which means we are not able to add/delete
or update the secret once created.

Signed-off-by: Madhu Rajanna <[email protected]>
  • Loading branch information
Madhu-1 authored and mergify[bot] committed Nov 9, 2023
1 parent f4c65f7 commit d97f4c3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions apis/csiaddons/v1alpha1/networkfence_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type SecretSpec struct {

// NetworkFenceSpec defines the desired state of NetworkFence
// +kubebuilder:validation:XValidation:rule="has(self.parameters) == has(oldSelf.parameters)",message="parameters are immutable"
// +kubebuilder:validation:XValidation:rule="has(self.secret) == has(oldSelf.secret)",message="secret is immutable"
type NetworkFenceSpec struct {
// Driver contains the name of CSI driver.
// +kubebuilder:validation:Required
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/csiaddons.openshift.io_networkfences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ spec:
x-kubernetes-validations:
- message: parameters are immutable
rule: has(self.parameters) == has(oldSelf.parameters)
- message: secret is immutable
rule: has(self.secret) == has(oldSelf.secret)
status:
description: NetworkFenceStatus defines the observed state of NetworkFence
properties:
Expand Down
2 changes: 2 additions & 0 deletions deploy/controller/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ spec:
x-kubernetes-validations:
- message: parameters are immutable
rule: has(self.parameters) == has(oldSelf.parameters)
- message: secret is immutable
rule: has(self.secret) == has(oldSelf.secret)
status:
description: NetworkFenceStatus defines the observed state of NetworkFence
properties:
Expand Down

0 comments on commit d97f4c3

Please sign in to comment.