@@ -218,21 +218,18 @@ type ImageContent struct {
218
218
// ContainerFormat is the format of the image container.
219
219
// qcow2 and raw images do not usually have a container. This is specified as "bare", which is also the default.
220
220
// Permitted values are ami, ari, aki, bare, ovf, ova, and docker.
221
- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="containerFormat is immutable"
222
221
// +kubebuilder:default:=bare
223
222
// +optional
224
223
ContainerFormat ImageContainerFormat `json:"containerFormat,omitempty"`
225
224
226
225
// DiskFormat is the format of the disk image.
227
226
// Normal values are "qcow2", or "raw". Glance may be configured to support others.
228
- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="diskFormat is immutable"
229
227
// +kubebuilder:validation:Required
230
228
DiskFormat ImageDiskFormat `json:"diskFormat"`
231
229
232
230
// Download describes how to obtain image data by downloading it from a URL.
233
231
// Must be set when creating a managed image.
234
- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="download is immutable"
235
- // +unionMember
232
+ // +kubebuilder:validation:Required
236
233
Download * ImageContentSourceDownload `json:"download,omitempty"`
237
234
}
238
235
@@ -273,21 +270,25 @@ type ImageHash struct {
273
270
}
274
271
275
272
// ImageResourceSpec contains the desired state of a Glance image
273
+ // +kubebuilder:validation:XValidation:rule="has(self.name) ? self.name == oldSelf.name : !has(oldSelf.name)",message="name is immutable"
274
+ // +kubebuilder:validation:XValidation:rule="has(self.protected) ? self.protected == oldSelf.protected : !has(oldSelf.protected)",message="name is immutable"
275
+ // +kubebuilder:validation:XValidation:rule="has(self.tags) ? self.tags == oldSelf.tags : !has(oldSelf.tags)",message="tags is immutable"
276
+ // +kubebuilder:validation:XValidation:rule="has(self.visibility) ? self.visibility == oldSelf.visibility : !has(oldSelf.visibility)",message="visibility is immutable"
277
+ // +kubebuilder:validation:XValidation:rule="has(self.properties) ? self.properties == oldSelf.properties : !has(oldSelf.properties)",message="properties is immutable"
276
278
type ImageResourceSpec struct {
277
279
// Name will be the name of the created Glance image. If not specified, the
278
280
// name of the Image object will be used.
279
- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="imageName is immutable"
281
+ // +kubebuilder:validation:MinLength:=1
282
+ // +kubebuilder:validation:MaxLength:=1000
280
283
// +optional
281
- Name * string `json:"name,omitempty"`
284
+ Name string `json:"name,omitempty"`
282
285
283
286
// Protected specifies that the image is protected from deletion.
284
287
// If not specified, the default is false.
285
- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="protected is immutable"
286
288
// +optional
287
289
Protected * bool `json:"protected,omitempty"`
288
290
289
291
// Tags is a list of tags which will be applied to the image. A tag has a maximum length of 255 characters.
290
- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="tags is immutable"
291
292
// +listType=set
292
293
// +optional
293
294
Tags []ImageTag `json:"tags,omitempty"`
@@ -298,7 +299,6 @@ type ImageResourceSpec struct {
298
299
Visibility * ImageVisibility `json:"visibility,omitempty"`
299
300
300
301
// Properties is metadata available to consumers of the image
301
- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="properties is immutable"
302
302
// +optional
303
303
Properties * ImageProperties `json:"properties,omitempty"`
304
304
0 commit comments