@@ -218,21 +218,18 @@ type ImageContent struct {
218218 // ContainerFormat is the format of the image container.
219219 // qcow2 and raw images do not usually have a container. This is specified as "bare", which is also the default.
220220 // Permitted values are ami, ari, aki, bare, ovf, ova, and docker.
221- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="containerFormat is immutable"
222221 // +kubebuilder:default:=bare
223222 // +optional
224223 ContainerFormat ImageContainerFormat `json:"containerFormat,omitempty"`
225224
226225 // DiskFormat is the format of the disk image.
227226 // Normal values are "qcow2", or "raw". Glance may be configured to support others.
228- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="diskFormat is immutable"
229227 // +kubebuilder:validation:Required
230228 DiskFormat ImageDiskFormat `json:"diskFormat"`
231229
232230 // Download describes how to obtain image data by downloading it from a URL.
233231 // 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
236233 Download * ImageContentSourceDownload `json:"download,omitempty"`
237234}
238235
@@ -273,21 +270,25 @@ type ImageHash struct {
273270}
274271
275272// 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"
276278type ImageResourceSpec struct {
277279 // Name will be the name of the created Glance image. If not specified, the
278280 // 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
280283 // +optional
281- Name * string `json:"name,omitempty"`
284+ Name string `json:"name,omitempty"`
282285
283286 // Protected specifies that the image is protected from deletion.
284287 // If not specified, the default is false.
285- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="protected is immutable"
286288 // +optional
287289 Protected * bool `json:"protected,omitempty"`
288290
289291 // 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"
291292 // +listType=set
292293 // +optional
293294 Tags []ImageTag `json:"tags,omitempty"`
@@ -298,7 +299,6 @@ type ImageResourceSpec struct {
298299 Visibility * ImageVisibility `json:"visibility,omitempty"`
299300
300301 // Properties is metadata available to consumers of the image
301- // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="properties is immutable"
302302 // +optional
303303 Properties * ImageProperties `json:"properties,omitempty"`
304304
0 commit comments