Skip to content

Commit 71fa48f

Browse files
committed
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.
1 parent 4336f38 commit 71fa48f

6 files changed

+8
-106
lines changed

api/v1alpha7/openstackmachine_types.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ type OpenStackMachineSpec struct {
8585
RootVolume *RootVolume `json:"rootVolume,omitempty"`
8686

8787
// AdditionalBlockDevices is a list of specifications for additional block devices to attach to the server instance
88-
//
89-
// + ---
90-
// + While it's possible to have unlimited number of block devices attached to a server instance, the number is
91-
// + limited to 255 to avoid rule cost exceeded error in CRD validation.
92-
// +kubebuilder:validation:MaxItems=255
9388
// +listType=map
9489
// +listMapKey=name
9590
// +optional

api/v1alpha7/types.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,12 @@ type RootVolume struct {
165165

166166
// BlockDeviceStorage is the storage type of a block device to create and
167167
// contains additional storage options.
168-
// +kubebuilder:validation:XValidation:rule="self.type == 'Volume' || !has(self.volume)",message="volume is forbidden when type is not Volume"
169168
// +union
170169
//
171170
//nolint:godot
172171
type BlockDeviceStorage struct {
173172
// Type is the type of block device to create.
174173
// This can be either "Volume" or "Local".
175-
// +kubebuilder:validation:Enum="Volume";"Local"
176-
// +kubebuilder:validation:Required
177174
// +unionDiscriminator
178175
Type BlockDeviceType `json:"type"`
179176

@@ -188,9 +185,6 @@ type BlockDeviceVolume struct {
188185
// Type is the Cinder volume type of the volume.
189186
// If omitted, the default Cinder volume type that is configured in the OpenStack cloud
190187
// will be used.
191-
// The maximum length of a volume type name is 255 characters, as per the OpenStack limit.
192-
// +kubebuilder:validation:MinLength=1
193-
// +kubebuilder:validation:MaxLength=255
194188
// +optional
195189
Type string `json:"type,omitempty"`
196190

@@ -199,10 +193,6 @@ type BlockDeviceVolume struct {
199193
// The availability zone must NOT contain spaces otherwise it will lead to volume that belongs
200194
// to this availability zone register failure, see kubernetes/cloud-provider-openstack#1379 for
201195
// further information.
202-
// The maximum length of availability zone name is 63 as per labels limits.
203-
// +kubebuilder:validation:MinLength=1
204-
// +kubebuilder:validation:MaxLength=63
205-
// +kubebuilder:validation:XValidation:rule="!self.contains(' ')",message="availabilityZone may not contain spaces"
206196
// +optional
207197
AvailabilityZone string `json:"availabilityZone,omitempty"`
208198
}
@@ -215,17 +205,13 @@ type AdditionalBlockDevice struct {
215205
// Also, this name will be used for tagging the block device.
216206
// Information about the block device tag can be obtained from the OpenStack
217207
// metadata API or the config drive.
218-
// +kubebuilder:validation:Required
219208
Name string `json:"name"`
220209

221210
// SizeGiB is the size of the block device in gibibytes (GiB).
222-
// +kubebuilder:validation:Minimum=1
223-
// +kubebuilder:validation:Required
224211
SizeGiB int `json:"sizeGiB"`
225212

226213
// Storage specifies the storage type of the block device and
227214
// additional storage options.
228-
// +kubebuilder:validation:Required
229215
Storage BlockDeviceStorage `json:"storage"`
230216
}
231217

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3789,7 +3789,6 @@ spec:
37893789
sizeGiB:
37903790
description: SizeGiB is the size of the block device
37913791
in gibibytes (GiB).
3792-
minimum: 1
37933792
type: integer
37943793
storage:
37953794
description: Storage specifies the storage type of the
@@ -3798,9 +3797,6 @@ spec:
37983797
type:
37993798
description: Type is the type of block device to
38003799
create. This can be either "Volume" or "Local".
3801-
enum:
3802-
- Volume
3803-
- Local
38043800
type: string
38053801
volume:
38063802
description: Volume contains additional storage
@@ -3814,39 +3810,23 @@ spec:
38143810
contain spaces otherwise it will lead to volume
38153811
that belongs to this availability zone register
38163812
failure, see kubernetes/cloud-provider-openstack#1379
3817-
for further information. The maximum length
3818-
of availability zone name is 63 as per labels
3819-
limits.
3820-
maxLength: 63
3821-
minLength: 1
3813+
for further information.
38223814
type: string
3823-
x-kubernetes-validations:
3824-
- message: availabilityZone may not contain
3825-
spaces
3826-
rule: '!self.contains('' '')'
38273815
type:
38283816
description: Type is the Cinder volume type
38293817
of the volume. If omitted, the default Cinder
38303818
volume type that is configured in the OpenStack
3831-
cloud will be used. The maximum length of
3832-
a volume type name is 255 characters, as per
3833-
the OpenStack limit.
3834-
maxLength: 255
3835-
minLength: 1
3819+
cloud will be used.
38363820
type: string
38373821
type: object
38383822
required:
38393823
- type
38403824
type: object
3841-
x-kubernetes-validations:
3842-
- message: volume is forbidden when type is not Volume
3843-
rule: self.type == 'Volume' || !has(self.volume)
38443825
required:
38453826
- name
38463827
- sizeGiB
38473828
- storage
38483829
type: object
3849-
maxItems: 255
38503830
type: array
38513831
x-kubernetes-list-map-keys:
38523832
- name

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,6 @@ spec:
16311631
sizeGiB:
16321632
description: SizeGiB is the size of the block
16331633
device in gibibytes (GiB).
1634-
minimum: 1
16351634
type: integer
16361635
storage:
16371636
description: Storage specifies the storage type
@@ -1642,9 +1641,6 @@ spec:
16421641
description: Type is the type of block device
16431642
to create. This can be either "Volume"
16441643
or "Local".
1645-
enum:
1646-
- Volume
1647-
- Local
16481644
type: string
16491645
volume:
16501646
description: Volume contains additional
@@ -1659,41 +1655,24 @@ spec:
16591655
spaces otherwise it will lead to volume
16601656
that belongs to this availability
16611657
zone register failure, see kubernetes/cloud-provider-openstack#1379
1662-
for further information. The maximum
1663-
length of availability zone name is
1664-
63 as per labels limits.
1665-
maxLength: 63
1666-
minLength: 1
1658+
for further information.
16671659
type: string
1668-
x-kubernetes-validations:
1669-
- message: availabilityZone may not
1670-
contain spaces
1671-
rule: '!self.contains('' '')'
16721660
type:
16731661
description: Type is the Cinder volume
16741662
type of the volume. If omitted, the
16751663
default Cinder volume type that is
16761664
configured in the OpenStack cloud
1677-
will be used. The maximum length of
1678-
a volume type name is 255 characters,
1679-
as per the OpenStack limit.
1680-
maxLength: 255
1681-
minLength: 1
1665+
will be used.
16821666
type: string
16831667
type: object
16841668
required:
16851669
- type
16861670
type: object
1687-
x-kubernetes-validations:
1688-
- message: volume is forbidden when type is
1689-
not Volume
1690-
rule: self.type == 'Volume' || !has(self.volume)
16911671
required:
16921672
- name
16931673
- sizeGiB
16941674
- storage
16951675
type: object
1696-
maxItems: 255
16971676
type: array
16981677
x-kubernetes-list-map-keys:
16991678
- name

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,6 @@ spec:
11771177
sizeGiB:
11781178
description: SizeGiB is the size of the block device in gibibytes
11791179
(GiB).
1180-
minimum: 1
11811180
type: integer
11821181
storage:
11831182
description: Storage specifies the storage type of the block
@@ -1186,9 +1185,6 @@ spec:
11861185
type:
11871186
description: Type is the type of block device to create.
11881187
This can be either "Volume" or "Local".
1189-
enum:
1190-
- Volume
1191-
- Local
11921188
type: string
11931189
volume:
11941190
description: Volume contains additional storage options
@@ -1201,36 +1197,22 @@ spec:
12011197
zone must NOT contain spaces otherwise it will lead
12021198
to volume that belongs to this availability zone register
12031199
failure, see kubernetes/cloud-provider-openstack#1379
1204-
for further information. The maximum length of availability
1205-
zone name is 63 as per labels limits.
1206-
maxLength: 63
1207-
minLength: 1
1200+
for further information.
12081201
type: string
1209-
x-kubernetes-validations:
1210-
- message: availabilityZone may not contain spaces
1211-
rule: '!self.contains('' '')'
12121202
type:
12131203
description: Type is the Cinder volume type of the volume.
12141204
If omitted, the default Cinder volume type that is
1215-
configured in the OpenStack cloud will be used. The
1216-
maximum length of a volume type name is 255 characters,
1217-
as per the OpenStack limit.
1218-
maxLength: 255
1219-
minLength: 1
1205+
configured in the OpenStack cloud will be used.
12201206
type: string
12211207
type: object
12221208
required:
12231209
- type
12241210
type: object
1225-
x-kubernetes-validations:
1226-
- message: volume is forbidden when type is not Volume
1227-
rule: self.type == 'Volume' || !has(self.volume)
12281211
required:
12291212
- name
12301213
- sizeGiB
12311214
- storage
12321215
type: object
1233-
maxItems: 255
12341216
type: array
12351217
x-kubernetes-list-map-keys:
12361218
- name

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,6 @@ spec:
977977
sizeGiB:
978978
description: SizeGiB is the size of the block device
979979
in gibibytes (GiB).
980-
minimum: 1
981980
type: integer
982981
storage:
983982
description: Storage specifies the storage type of the
@@ -986,9 +985,6 @@ spec:
986985
type:
987986
description: Type is the type of block device to
988987
create. This can be either "Volume" or "Local".
989-
enum:
990-
- Volume
991-
- Local
992988
type: string
993989
volume:
994990
description: Volume contains additional storage
@@ -1002,39 +998,23 @@ spec:
1002998
contain spaces otherwise it will lead to volume
1003999
that belongs to this availability zone register
10041000
failure, see kubernetes/cloud-provider-openstack#1379
1005-
for further information. The maximum length
1006-
of availability zone name is 63 as per labels
1007-
limits.
1008-
maxLength: 63
1009-
minLength: 1
1001+
for further information.
10101002
type: string
1011-
x-kubernetes-validations:
1012-
- message: availabilityZone may not contain
1013-
spaces
1014-
rule: '!self.contains('' '')'
10151003
type:
10161004
description: Type is the Cinder volume type
10171005
of the volume. If omitted, the default Cinder
10181006
volume type that is configured in the OpenStack
1019-
cloud will be used. The maximum length of
1020-
a volume type name is 255 characters, as per
1021-
the OpenStack limit.
1022-
maxLength: 255
1023-
minLength: 1
1007+
cloud will be used.
10241008
type: string
10251009
type: object
10261010
required:
10271011
- type
10281012
type: object
1029-
x-kubernetes-validations:
1030-
- message: volume is forbidden when type is not Volume
1031-
rule: self.type == 'Volume' || !has(self.volume)
10321013
required:
10331014
- name
10341015
- sizeGiB
10351016
- storage
10361017
type: object
1037-
maxItems: 255
10381018
type: array
10391019
x-kubernetes-list-map-keys:
10401020
- name

0 commit comments

Comments
 (0)