Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit 115c18c

Browse files
committed
Fix image properties propagation
Signed-off-by: Matej Feder <[email protected]>
1 parent f048fa7 commit 115c18c

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

api/v1alpha1/openstacknodeimagerelease_types.go

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,57 @@ type OpenStackNodeImage struct {
4141
CreateOpts *CreateOpts `json:"createOpts" yaml:"createOpts"`
4242
}
4343

44+
// TODO: Reimplement logic to import `images.CreateOpts` from Gophercloud with a `Properties` override.
45+
// The current `images.CreateOpts` defines `json:"-"` for the `Properties` field, making it unsuitable
46+
// for proper serialization/deserialization required for `CreateOpts` used in Kubernetes resources
47+
// and `nodeimagerelease.yaml`.
48+
//
49+
// One solution is to create a new struct specifically for serialization/deserialization
50+
// that embeds `images.CreateOpts` and redefines the `Properties` field to allow proper handling.
51+
// Alternatively, consider overriding the default marshalling/unmarshalling functions to achieve the desired behavior.
52+
//
4453
// CreateOpts represents options used to create an image.
45-
type CreateOpts images.CreateOpts
54+
type CreateOpts struct {
55+
// Name is the name of the new image.
56+
Name string `json:"name" required:"true"`
57+
58+
// Id is the the image ID.
59+
ID string `json:"id,omitempty"`
60+
61+
// Visibility defines who can see/use the image.
62+
Visibility *images.ImageVisibility `json:"visibility,omitempty"`
63+
64+
// Hidden is whether the image is listed in default image list or not.
65+
Hidden *bool `json:"os_hidden,omitempty"`
66+
67+
// Tags is a set of image tags.
68+
Tags []string `json:"tags,omitempty"`
69+
70+
// ContainerFormat is the format of the
71+
// container. Valid values are ami, ari, aki, bare, and ovf.
72+
ContainerFormat string `json:"container_format,omitempty"`
73+
74+
// DiskFormat is the format of the disk. If set,
75+
// valid values are ami, ari, aki, vhd, vmdk, raw, qcow2, vdi,
76+
// and iso.
77+
DiskFormat string `json:"disk_format,omitempty"`
78+
79+
// MinDisk is the amount of disk space in
80+
// GB that is required to boot the image.
81+
MinDisk int `json:"min_disk,omitempty"`
82+
83+
// MinRAM is the amount of RAM in MB that
84+
// is required to boot the image.
85+
MinRAM int `json:"min_ram,omitempty"`
86+
87+
// protected is whether the image is not deletable.
88+
Protected *bool `json:"protected,omitempty"`
89+
90+
// properties is a set of properties, if any, that
91+
// are associated with the image.
92+
Properties map[string]string `json:"properties,omitempty"`
93+
}
94+
4695

4796
// OpenStackNodeImageReleaseStatus defines the observed state of OpenStackNodeImageRelease.
4897
type OpenStackNodeImageReleaseStatus struct {

config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstacknodeimagereleases.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ spec:
114114
description: Hidden is whether the image is listed in default
115115
image list or not.
116116
type: boolean
117+
properties:
118+
additionalProperties:
119+
type: string
120+
description: |-
121+
properties is a set of properties, if any, that
122+
are associated with the image.
123+
type: object
117124
protected:
118125
description: protected is whether the image is not deletable.
119126
type: boolean

0 commit comments

Comments
 (0)