From e44d4faaa38805dad8318b91a96bc2b4ad52a756 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Thu, 26 Oct 2023 13:10:46 -0400 Subject: [PATCH] api: remove CEL validations for `AdditionalBlockDevices` I've put that into a separate commit so we can re-add it later. It also serves as documentation for the work we have done to add CEL. However and unfortunately, we don't have CEL tests in place now so we decided to not have CEL validations for now; add them later and then we'll be able to revert this commit. --- api/v1alpha7/openstackmachine_types.go | 1 - api/v1alpha7/types.go | 12 ------------ ...ture.cluster.x-k8s.io_openstackclusters.yaml | 16 ---------------- ...ster.x-k8s.io_openstackclustertemplates.yaml | 17 ----------------- ...ture.cluster.x-k8s.io_openstackmachines.yaml | 15 --------------- ...ster.x-k8s.io_openstackmachinetemplates.yaml | 16 ---------------- 6 files changed, 77 deletions(-) diff --git a/api/v1alpha7/openstackmachine_types.go b/api/v1alpha7/openstackmachine_types.go index 3aa4a9b170..e293a89afd 100644 --- a/api/v1alpha7/openstackmachine_types.go +++ b/api/v1alpha7/openstackmachine_types.go @@ -89,7 +89,6 @@ type OpenStackMachineSpec struct { // + --- // + While it's possible to have unlimited number of block devices attached to a server instance, the number is // + limited to 255 to avoid rule cost exceeded error in CRD validation. - // +kubebuilder:validation:MaxItems=255 // +listType=map // +listMapKey=name // +optional diff --git a/api/v1alpha7/types.go b/api/v1alpha7/types.go index c2c01faa2b..f6f51023ce 100644 --- a/api/v1alpha7/types.go +++ b/api/v1alpha7/types.go @@ -165,15 +165,12 @@ type RootVolume struct { // blockDeviceStorage is the storage type of a block device to create and // contains additional storage options. -// +kubebuilder:validation:XValidation:rule="self.type == 'Volume' || !has(self.volume)",message="volume is forbidden when type is not Volume" // +union // //nolint:godot type BlockDeviceStorage struct { // type is the type of block device to create. // This can be either "Volume" or "Local". - // +kubebuilder:validation:Enum="Volume";"Local" - // +kubebuilder:validation:Required // +unionDiscriminator Type BlockDeviceType `json:"type"` @@ -189,8 +186,6 @@ type BlockDeviceVolume struct { // If omitted, the default Cinder volume type that is configured in the OpenStack cloud // will be used. // The maximum length of a volume type name is 255 characters, as per the OpenStack limit. - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=255 // +optional Type string `json:"type,omitempty"` @@ -200,9 +195,6 @@ type BlockDeviceVolume struct { // to this availability zone register failure, see kubernetes/cloud-provider-openstack#1379 for // further information. // The maximum length of availability zone name is 63 as per labels limits. - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=63 - // +kubebuilder:validation:XValidation:rule="!self.contains(' ')",message="availabilityZone may not contain spaces" // +optional AvailabilityZone string `json:"availabilityZone,omitempty"` } @@ -215,17 +207,13 @@ type AdditionalBlockDevice struct { // Also, this name will be used for tagging the block device. // Information about the block device tag can be obtained from the OpenStack // metadata API or the config drive. - // +kubebuilder:validation:Required Name string `json:"name"` // sizeGiB is the size of the block device in gibibytes (GiB). - // +kubebuilder:validation:Minimum=1 - // +kubebuilder:validation:Required SizeGiB int `json:"sizeGiB"` // storage specifies the storage type of the block device and // additional storage options. - // +kubebuilder:validation:Required Storage BlockDeviceStorage `json:"storage"` } diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml index 9ccda5093f..efceac6a4f 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml @@ -3789,7 +3789,6 @@ spec: sizeGiB: description: sizeGiB is the size of the block device in gibibytes (GiB). - minimum: 1 type: integer storage: description: storage specifies the storage type of the @@ -3798,9 +3797,6 @@ spec: type: description: type is the type of block device to create. This can be either "Volume" or "Local". - enum: - - Volume - - Local type: string volume: description: volume contains additional storage @@ -3817,13 +3813,7 @@ spec: for further information. The maximum length of availability zone name is 63 as per labels limits. - maxLength: 63 - minLength: 1 type: string - x-kubernetes-validations: - - message: availabilityZone may not contain - spaces - rule: '!self.contains('' '')' type: description: type is the Cinder volume type of the volume. If omitted, the default Cinder @@ -3831,22 +3821,16 @@ spec: cloud will be used. The maximum length of a volume type name is 255 characters, as per the OpenStack limit. - maxLength: 255 - minLength: 1 type: string type: object required: - type type: object - x-kubernetes-validations: - - message: volume is forbidden when type is not Volume - rule: self.type == 'Volume' || !has(self.volume) required: - name - sizeGiB - storage type: object - maxItems: 255 type: array x-kubernetes-list-map-keys: - name diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml index f27d27964b..0d0ebd4e1d 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml @@ -1631,7 +1631,6 @@ spec: sizeGiB: description: sizeGiB is the size of the block device in gibibytes (GiB). - minimum: 1 type: integer storage: description: storage specifies the storage type @@ -1642,9 +1641,6 @@ spec: description: type is the type of block device to create. This can be either "Volume" or "Local". - enum: - - Volume - - Local type: string volume: description: volume contains additional @@ -1662,13 +1658,7 @@ spec: for further information. The maximum length of availability zone name is 63 as per labels limits. - maxLength: 63 - minLength: 1 type: string - x-kubernetes-validations: - - message: availabilityZone may not - contain spaces - rule: '!self.contains('' '')' type: description: type is the Cinder volume type of the volume. If omitted, the @@ -1677,23 +1667,16 @@ spec: will be used. The maximum length of a volume type name is 255 characters, as per the OpenStack limit. - maxLength: 255 - minLength: 1 type: string type: object required: - type type: object - x-kubernetes-validations: - - message: volume is forbidden when type is - not Volume - rule: self.type == 'Volume' || !has(self.volume) required: - name - sizeGiB - storage type: object - maxItems: 255 type: array x-kubernetes-list-map-keys: - name diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml index e17d1169a0..7480d874ae 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml @@ -1177,7 +1177,6 @@ spec: sizeGiB: description: sizeGiB is the size of the block device in gibibytes (GiB). - minimum: 1 type: integer storage: description: storage specifies the storage type of the block @@ -1186,9 +1185,6 @@ spec: type: description: type is the type of block device to create. This can be either "Volume" or "Local". - enum: - - Volume - - Local type: string volume: description: volume contains additional storage options @@ -1203,34 +1199,23 @@ spec: failure, see kubernetes/cloud-provider-openstack#1379 for further information. The maximum length of availability zone name is 63 as per labels limits. - maxLength: 63 - minLength: 1 type: string - x-kubernetes-validations: - - message: availabilityZone may not contain spaces - rule: '!self.contains('' '')' type: description: type is the Cinder volume type of the volume. If omitted, the default Cinder volume type that is configured in the OpenStack cloud will be used. The maximum length of a volume type name is 255 characters, as per the OpenStack limit. - maxLength: 255 - minLength: 1 type: string type: object required: - type type: object - x-kubernetes-validations: - - message: volume is forbidden when type is not Volume - rule: self.type == 'Volume' || !has(self.volume) required: - name - sizeGiB - storage type: object - maxItems: 255 type: array x-kubernetes-list-map-keys: - name diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml index 565d37edd2..7fb79cbb8c 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml @@ -977,7 +977,6 @@ spec: sizeGiB: description: sizeGiB is the size of the block device in gibibytes (GiB). - minimum: 1 type: integer storage: description: storage specifies the storage type of the @@ -986,9 +985,6 @@ spec: type: description: type is the type of block device to create. This can be either "Volume" or "Local". - enum: - - Volume - - Local type: string volume: description: volume contains additional storage @@ -1005,13 +1001,7 @@ spec: for further information. The maximum length of availability zone name is 63 as per labels limits. - maxLength: 63 - minLength: 1 type: string - x-kubernetes-validations: - - message: availabilityZone may not contain - spaces - rule: '!self.contains('' '')' type: description: type is the Cinder volume type of the volume. If omitted, the default Cinder @@ -1019,22 +1009,16 @@ spec: cloud will be used. The maximum length of a volume type name is 255 characters, as per the OpenStack limit. - maxLength: 255 - minLength: 1 type: string type: object required: - type type: object - x-kubernetes-validations: - - message: volume is forbidden when type is not Volume - rule: self.type == 'Volume' || !has(self.volume) required: - name - sizeGiB - storage type: object - maxItems: 255 type: array x-kubernetes-list-map-keys: - name