Skip to content

Commit

Permalink
api: remove CEL validations for AdditionalBlockDevices
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
EmilienM committed Oct 27, 2023
1 parent 1ac7302 commit ff4a773
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 83 deletions.
5 changes: 0 additions & 5 deletions api/v1alpha7/openstackmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ type OpenStackMachineSpec struct {
RootVolume *RootVolume `json:"rootVolume,omitempty"`

// additionalBlockDevices is a list of specifications for additional block devices to attach to the server instance
//
// + ---
// + 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
Expand Down
14 changes: 0 additions & 14 deletions api/v1alpha7/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand All @@ -188,9 +185,6 @@ type BlockDeviceVolume struct {
// 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.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=255
// +optional
Type string `json:"type,omitempty"`

Expand All @@ -199,10 +193,6 @@ type BlockDeviceVolume struct {
// The availability zone must NOT contain spaces otherwise it will lead to volume that belongs
// 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"`
}
Expand All @@ -215,17 +205,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"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -3817,36 +3813,24 @@ 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
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -1005,36 +1001,24 @@ 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
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
Expand Down

0 comments on commit ff4a773

Please sign in to comment.