Skip to content

Commit

Permalink
Fix image properties propagation
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Feder <[email protected]>
  • Loading branch information
matofeder committed Jan 16, 2025
1 parent f048fa7 commit afeee9f
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
54 changes: 53 additions & 1 deletion api/v1alpha1/openstacknodeimagerelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,59 @@ type OpenStackNodeImage struct {
}

// CreateOpts represents options used to create an image.
type CreateOpts images.CreateOpts
// TODO: Reimplement logic to import `images.CreateOpts` from Gophercloud with a `Properties` override.
// The current `images.CreateOpts` defines `json:"-"` for the `Properties` field, making it unsuitable
// for proper unmarshalling required for `CreateOpts` used in Kubernetes resources
// and `nodeimagerelease.yaml`.
//
// One solution is to create a new struct specifically for unmarshalling
// that embeds `images.CreateOpts` and redefines the `Properties` field to allow proper handling.
type CreateOpts struct {
// Name is the name of the new image.
Name string `json:"name" required:"true"`

// Id is the the image ID.
ID string `json:"id,omitempty"`

// Visibility defines who can see/use the image.
Visibility *images.ImageVisibility `json:"visibility,omitempty"`

// Hidden is whether the image is listed in default image list or not.

Check failure on line 62 in api/v1alpha1/openstacknodeimagerelease_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

whyNoLint: include an explanation for nolint directive (gocritic)
//nolint:tagliatelle
Hidden *bool `json:"os_hidden,omitempty"`

// Tags is a set of image tags.
Tags []string `json:"tags,omitempty"`

// ContainerFormat is the format of the

Check failure on line 69 in api/v1alpha1/openstacknodeimagerelease_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

whyNoLint: include an explanation for nolint directive (gocritic)
// container. Valid values are ami, ari, aki, bare, and ovf.
//nolint:tagliatelle
ContainerFormat string `json:"container_format,omitempty"`

// DiskFormat is the format of the disk. If set,

Check failure on line 74 in api/v1alpha1/openstacknodeimagerelease_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

whyNoLint: include an explanation for nolint directive (gocritic)
// valid values are ami, ari, aki, vhd, vmdk, raw, qcow2, vdi,
// and iso.
//nolint:tagliatelle
DiskFormat string `json:"disk_format,omitempty"`

// MinDisk is the amount of disk space in

Check failure on line 80 in api/v1alpha1/openstacknodeimagerelease_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

whyNoLint: include an explanation for nolint directive (gocritic)
// GB that is required to boot the image.
//nolint:tagliatelle
MinDisk int `json:"min_disk,omitempty"`

// MinRAM is the amount of RAM in MB that

Check failure on line 85 in api/v1alpha1/openstacknodeimagerelease_types.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

whyNoLint: include an explanation for nolint directive (gocritic)
// is required to boot the image.
//nolint:tagliatelle
MinRAM int `json:"min_ram,omitempty"`

// protected is whether the image is not deletable.
Protected *bool `json:"protected,omitempty"`

// properties is a set of properties, if any, that
// are associated with the image.
Properties map[string]string `json:"properties,omitempty"`
}


// OpenStackNodeImageReleaseStatus defines the observed state of OpenStackNodeImageRelease.
type OpenStackNodeImageReleaseStatus struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ spec:
description: Hidden is whether the image is listed in default
image list or not.
type: boolean
properties:
additionalProperties:
type: string
description: |-
properties is a set of properties, if any, that
are associated with the image.
type: object
protected:
description: protected is whether the image is not deletable.
type: boolean
Expand Down

0 comments on commit afeee9f

Please sign in to comment.