@@ -163,20 +163,81 @@ type RootVolume struct {
163
163
AvailabilityZone string `json:"availabilityZone,omitempty"`
164
164
}
165
165
166
- type AdditionalBlockDevice struct {
167
- // Name of the Cinder volume in the context of a machine.
168
- // It will be combined with the machine name to make the actual volume name.
169
- Name string `json:"name"`
170
- // Size is the size in GB of the volume.
171
- Size int `json:"diskSize"`
172
- // VolumeType is the volume type of the volume.
173
- // If omitted, the default type will be used.
174
- VolumeType string `json:"volumeType,omitempty"`
175
- // AvailabilityZone is the volume availability zone to create the volume in.
166
+ // blockDeviceStorage is the storage type of a block device to create and
167
+ // contains additional storage options.
168
+ // +union
169
+ //
170
+ //nolint:godot
171
+ type BlockDeviceStorage struct {
172
+ // type is the type of block device to create.
173
+ // This can be either "Volume" or "Local".
174
+ // +kubebuilder:validation:Enum="Volume";"Local"
175
+ // +kubebuilder:validation:Required
176
+ // +unionDiscriminator
177
+ Type BlockDeviceType `json:"type"`
178
+
179
+ // volume contains additional storage options for a volume block device.
180
+ // +optional
181
+ Volume * BlockDeviceVolume `json:"volume,omitempty"`
182
+ }
183
+
184
+ // blockDeviceVolume contains additional storage options for a volume block device.
185
+ type BlockDeviceVolume struct {
186
+ // type is the Cinder volume type of the volume.
187
+ // If omitted, the default Cinder volume type that is configured in the OpenStack cloud
188
+ // will be used.
189
+ // The maximum length of a volume type name is 255 characters, as per the OpenStack limit.
190
+ // +kubebuilder:validation:MinLength=1
191
+ // +kubebuilder:validation:MaxLength=255
192
+ // +optional
193
+ Type string `json:"type,omitempty"`
194
+
195
+ // availabilityZone is the volume availability zone to create the volume in.
176
196
// If omitted, the availability zone of the server will be used.
197
+ // The availability zone must NOT contain spaces otherwise it will lead to volume that belongs
198
+ // to this availability zone register failure, see kubernetes/cloud-provider-openstack#1379 for
199
+ // further information.
200
+ // The maximum length of availability zone name is 63 as per labels limits.
201
+ // +kubebuilder:validation:MinLength=1
202
+ // +kubebuilder:validation:MaxLength=63
203
+ // +kubebuilder:validation:XValidation:rule="!self.contains(' ')",message="availabilityZone may not contain spaces"
204
+ // +optional
177
205
AvailabilityZone string `json:"availabilityZone,omitempty"`
178
206
}
179
207
208
+ // additionalBlockDevice is a block device to attach to the server.
209
+ type AdditionalBlockDevice struct {
210
+ // name of the block device in the context of a machine.
211
+ // If the block device is a volume, the Cinder volume will be named
212
+ // as a combination of the machine name and this name.
213
+ // Also, this name will be used for tagging the block device.
214
+ // Information about the block device tag can be obtained from the OpenStack
215
+ // metadata API or the config drive.
216
+ // +kubebuilder:validation:Required
217
+ Name string `json:"name"`
218
+
219
+ // sizeGiB is the size of the block device in gibibytes (GiB).
220
+ // +kubebuilder:validation:Minimum=1
221
+ // +kubebuilder:validation:Required
222
+ SizeGiB int `json:"sizeGiB"`
223
+
224
+ // storage specifies the storage type of the block device and
225
+ // additional storage options.
226
+ // +kubebuilder:validation:Required
227
+ Storage BlockDeviceStorage `json:"storage"`
228
+ }
229
+
230
+ // BlockDeviceType defines the type of block device to create.
231
+ type BlockDeviceType string
232
+
233
+ const (
234
+ // LocalBlockDevice is an ephemeral block device attached to the server.
235
+ LocalBlockDevice BlockDeviceType = "Local"
236
+
237
+ // VolumeBlockDevice is a volume block device attached to the server.
238
+ VolumeBlockDevice BlockDeviceType = "Volume"
239
+ )
240
+
180
241
// NetworkStatus contains basic information about an existing neutron network.
181
242
type NetworkStatus struct {
182
243
Name string `json:"name"`
0 commit comments