Skip to content

Commit

Permalink
feat(cvi): namespace validation for vi/vd ObjectRef (#504)
Browse files Browse the repository at this point in the history
Currently, when specifying ObjectRef in ClusterVirtualImage to namespace scoped VirtualDisk and VirtualImage resources lack validation for the presence of namespace, its minimum and maximum lengths
---------
Signed-off-by: Daniil Antoshin <[email protected]>
Signed-off-by: Daniil Antoshin <[email protected]>
Co-authored-by: Yaroslav Borbat <[email protected]>
  • Loading branch information
danilrwx authored Nov 6, 2024
1 parent 083032e commit ce8295c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crds/clustervirtualimages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ spec:
description: |
Use an existing `VirtualImage`, `ClusterVirtualImage` or `VirtualDisk` to create an image.
required: ["kind", "name"]
x-kubernetes-validations:
- rule: "self.kind == 'VirtualImage' || self.kind == 'VirtualDisk' ? has(self.__namespace__) && size(self.__namespace__) > 0 : true"
message: The namespace is required for VirtualDisk and VirtualImage
- rule: "self.kind == 'VirtualImage' || self.kind == 'VirtualDisk' ? has(self.__namespace__) && size(self.__namespace__) < 64 : true"
message: "The namespace must be no longer than 63 characters."
properties:
kind:
type: string
Expand Down

0 comments on commit ce8295c

Please sign in to comment.