Skip to content

Commit

Permalink
Adding validation rules into CRDs
Browse files Browse the repository at this point in the history
  • Loading branch information
cici37 committed Apr 24, 2024
1 parent 39cf838 commit 70a9cc3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ spec:
object, name and namespace of the VolumeGroupSnapshot object MUST
be provided for binding to happen. This field is immutable after
creation. Required.
x-kubernetes-validations:
- message: both Spec.VolumeGroupSnapshotRef.Name and Spec.VolumeGroupSnapshotRef.Namespace must be set
rule: 'has(self.name) && has(self.__namespace__)'
properties:
apiVersion:
description: API version of the referent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ spec:
may be left nil to indicate that the default class will be used.
Empty string is not allowed for this field.
type: string
x-kubernetes-validations:
- message: must not be the empty string
rule: 'size(self) > 0'
required:
- source
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ spec:
object, name and namespace of the VolumeSnapshot object MUST be
provided for binding to happen. This field is immutable after creation.
Required.
x-kubernetes-validations:
- message: both Spec.VolumeSnapshotRef.Name and Spec.VolumeSnapshotRef.Namespace must be set
rule: 'has(self.name) && has(self.__namespace__)'
properties:
apiVersion:
description: API version of the referent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ spec:
as default, CreateSnapshot will fail and generate an event. Empty
string is not allowed for this field.'
type: string
x-kubernetes-validations:
- message: must not be the empty string
rule: 'size(self) > 0'
required:
- source
type: object
Expand Down

0 comments on commit 70a9cc3

Please sign in to comment.