@@ -17,40 +17,82 @@ limitations under the License.
1717package v1alpha1
1818
1919import (
20+ "github.com/gophercloud/gophercloud/openstack/imageservice/v2/images"
2021 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122 apiv1alpha7 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
23+ clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
2224)
2325
2426// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
2527// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2628
2729// OpenStackNodeImageReleaseSpec defines the desired state of OpenStackNodeImageRelease.
2830type OpenStackNodeImageReleaseSpec struct {
29- // The name of the node image
30- Name string `json:"name"`
31- // The URL of the node image
32- URL string `json:"url"`
33- // The DiskFormat of the node image
34- DiskFormat string `json:"diskFormat"`
35- // The ContainerFormat of the node image
36- ContainerFormat string `json:"containerFormat"`
3731 // The name of the cloud to use from the clouds secret
3832 CloudName string `json:"cloudName"`
3933 // IdentityRef is a reference to a identity to be used when reconciling this cluster
40- IdentityRef * apiv1alpha7.OpenStackIdentityReference `json:"identityRef,omitempty"`
34+ IdentityRef * apiv1alpha7.OpenStackIdentityReference `json:"identityRef"`
35+ // Image represents options used to upload an image
36+ Image * OpenStackNodeImage `json:"image"`
37+ }
38+
39+ // OpenStackNodeImage defines image fields required for image upload.
40+ type OpenStackNodeImage struct {
41+ URL string `json:"url" yaml:"url"`
42+ // CreateOpts represents options used to create an image.
43+ CreateOpts * CreateOpts `json:"createOpts" yaml:"createOpts"`
44+ }
45+
46+ // CreateOpts represents options used to create an image.
47+ // CreateOpts attributes are taken from github.com/gophercloud/gophercloud/openstack/imageservice/v2/images.
48+ // Consider.
49+ type CreateOpts struct {
50+ // Name is the name of the new image.
51+ Name string `json:"name" yaml:"name" required:"true"`
52+ // Id is the the image ID.
53+ ID string `json:"id,omitempty" yaml:"id,omitempty"`
54+ // Visibility defines who can see/use the image.
55+ Visibility * images.ImageVisibility `json:"visibility,omitempty" yaml:"visibility,omitempty"`
56+ // Hidden is whether the image is listed in default image list or not.
57+ Hidden * bool `json:"os_hidden,omitempty" yaml:"os_hidden,omitempty"` //nolint:tagliatelle // OS API expects snake case query attrs
58+ // Tags is a set of image tags.
59+ Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
60+ // ContainerFormat is the format of the
61+ // container. Valid values are ami, ari, aki, bare, and ovf.
62+ ContainerFormat string `json:"container_format,omitempty" yaml:"container_format,omitempty"` //nolint:tagliatelle // OS API expects snake case query attrs
63+ // DiskFormat is the format of the disk. If set,
64+ // valid values are ami, ari, aki, vhd, vmdk, raw, qcow2, vdi,
65+ // and iso.
66+ DiskFormat string `json:"disk_format,omitempty" yaml:"disk_format,omitempty"` //nolint:tagliatelle // OS API expects snake case query attrs
67+ // MinDisk is the amount of disk space in
68+ // GB that is required to boot the image.
69+ MinDisk int `json:"min_disk,omitempty" yaml:"min_disk,omitempty"` //nolint:tagliatelle // OS API expects snake case query attrs
70+ // MinRAM is the amount of RAM in MB that
71+ // is required to boot the image.
72+ MinRAM int `json:"min_ram,omitempty" yaml:"min_ram,omitempty"` //nolint:tagliatelle // OS API expects snake case query attrs
73+ // protected is whether the image is not deletable.
74+ Protected * bool `json:"protected,omitempty" yaml:"protected,omitempty"`
75+ // properties is a set of properties, if any, that
76+ // are associated with the image.
77+ Properties map [string ]string `json:"-" yaml:"-"`
4178}
4279
4380// OpenStackNodeImageReleaseStatus defines the observed state of OpenStackNodeImageRelease.
4481type OpenStackNodeImageReleaseStatus struct {
4582 // +optional
4683 // +kubebuilder:default:=false
4784 Ready bool `json:"ready,omitempty"`
85+ // Conditions defines current service state of the OpenStackNodeImageRelease.
86+ // +optional
87+ Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`
4888}
4989
5090//+kubebuilder:object:root=true
5191//+kubebuilder:subresource:status
5292//+kubebuilder:printcolumn:name="Ready",type="boolean",JSONPath=".status.ready"
5393//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of OpenStackNodeImageRelease"
94+ //+kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
95+ //+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
5496
5597// OpenStackNodeImageRelease is the Schema for the openstacknodeimagereleases API.
5698type OpenStackNodeImageRelease struct {
@@ -61,6 +103,16 @@ type OpenStackNodeImageRelease struct {
61103 Status OpenStackNodeImageReleaseStatus `json:"status,omitempty"`
62104}
63105
106+ // GetConditions returns the observations of the operational state of the OpenStackNodeImageRelease resource.
107+ func (r * OpenStackNodeImageRelease ) GetConditions () clusterv1beta1.Conditions {
108+ return r .Status .Conditions
109+ }
110+
111+ // SetConditions sets the underlying service state of the OpenStackNodeImageRelease to the predescribed clusterv1.Conditions.
112+ func (r * OpenStackNodeImageRelease ) SetConditions (conditions clusterv1beta1.Conditions ) {
113+ r .Status .Conditions = conditions
114+ }
115+
64116//+kubebuilder:object:root=true
65117
66118// OpenStackNodeImageReleaseList contains a list of OpenStackNodeImageRelease.
0 commit comments