Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix corner cases bugs found in CEL validation #481

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apis/csiaddons/v1alpha1/networkfence_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
// VolumeReplicationClassSpec specifies parameters that an underlying storage system uses
// when creating a volume replica. A specific VolumeReplicationClass is used by specifying
// its name in a VolumeReplication object.
// +kubebuilder:validation:XValidation:rule="has(self.parameters) == has(oldSelf.parameters)",message="parameters are immutable"
type VolumeReplicationClassSpec struct {
// Provisioner is the name of storage provisioner
// +kubebuilder:validation:Required
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/csiaddons.openshift.io_networkfences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ spec:
- driver
- fenceState
type: object
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
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ spec:
required:
- provisioner
type: object
x-kubernetes-validations:
- message: parameters are immutable
rule: has(self.parameters) == has(oldSelf.parameters)
status:
description: VolumeReplicationClassStatus defines the observed state of
VolumeReplicationClass.
Expand Down
8 changes: 8 additions & 0 deletions deploy/controller/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ spec:
- driver
- fenceState
type: object
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 Expand Up @@ -778,6 +783,9 @@ spec:
required:
- provisioner
type: object
x-kubernetes-validations:
- message: parameters are immutable
rule: has(self.parameters) == has(oldSelf.parameters)
status:
description: VolumeReplicationClassStatus defines the observed state of
VolumeReplicationClass.
Expand Down