@@ -16,6 +16,8 @@ limitations under the License.
1616
1717package v1alpha1
1818
19+ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
20+
1921// ShareResourceSpec contains the desired state of the resource.
2022type ShareResourceSpec struct {
2123 // name will be the name of the created resource. If not specified, the
@@ -29,13 +31,34 @@ type ShareResourceSpec struct {
2931 // +optional
3032 Description * string `json:"description,omitempty"`
3133
32- // TODO(scaffolding): Add more types.
33- // To see what is supported, you can take inspiration from the CreateOpts structure from
34- // github.com/gophercloud/gophercloud/v2/openstack/sharedfilesystems/v2/shares
35- //
36- // Until you have implemented mutability for the field, you must add a CEL validation
37- // preventing the field being modified:
38- // `// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="<fieldname> is immutable"`
34+ // size is the size of the share, in gibibytes (GiB).
35+ // +kubebuilder:validation:Minimum=1
36+ // +required
37+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="size is immutable"
38+ Size int32 `json:"size,omitempty"`
39+
40+ // shareProto is the file system protocol for the share.
41+ // Valid values are NFS, CIFS, GlusterFS, HDFS, CephFS, or MAPRFS.
42+ // +kubebuilder:validation:Enum=NFS;CIFS;GlusterFS;HDFS;CephFS;MAPRFS
43+ // +required
44+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="shareProto is immutable"
45+ ShareProto string `json:"shareProto,omitempty"`
46+
47+ // availabilityZone is the availability zone in which to create the share.
48+ // +kubebuilder:validation:MaxLength:=255
49+ // +optional
50+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="availabilityZone is immutable"
51+ AvailabilityZone string `json:"availabilityZone,omitempty"`
52+
53+ // metadata key and value pairs to be associated with the share.
54+ // +kubebuilder:validation:MaxItems:=64
55+ // +listType=atomic
56+ // +optional
57+ Metadata []ShareMetadata `json:"metadata,omitempty"`
58+
59+ // isPublic defines whether the share is publicly visible.
60+ // +optional
61+ IsPublic * bool `json:"isPublic,omitempty"`
3962}
4063
4164// ShareFilter defines an existing resource by its properties
@@ -51,9 +74,19 @@ type ShareFilter struct {
5174 // +optional
5275 Description * string `json:"description,omitempty"`
5376
54- // TODO(scaffolding): Add more types.
55- // To see what is supported, you can take inspiration from the ListOpts structure from
56- // github.com/gophercloud/gophercloud/v2/openstack/sharedfilesystems/v2/shares
77+ // shareProto is the file system protocol to filter by
78+ // +kubebuilder:validation:Enum=NFS;CIFS;GlusterFS;HDFS;CephFS;MAPRFS
79+ // +optional
80+ ShareProto * string `json:"shareProto,omitempty"`
81+
82+ // status is the share status to filter by
83+ // +kubebuilder:validation:Enum=creating;available;deleting;error;error_deleting;manage_starting;manage_error;unmanage_starting;unmanage_error;extending;extending_error;shrinking;shrinking_error
84+ // +optional
85+ Status * string `json:"status,omitempty"`
86+
87+ // isPublic filters by public visibility
88+ // +optional
89+ IsPublic * bool `json:"isPublic,omitempty"`
5790}
5891
5992// ShareResourceStatus represents the observed state of the resource.
@@ -68,7 +101,82 @@ type ShareResourceStatus struct {
68101 // +optional
69102 Description string `json:"description,omitempty"`
70103
71- // TODO(scaffolding): Add more types.
72- // To see what is supported, you can take inspiration from the Share structure from
73- // github.com/gophercloud/gophercloud/v2/openstack/sharedfilesystems/v2/shares
104+ // size is the size of the share in GiB.
105+ // +optional
106+ Size * int32 `json:"size,omitempty"`
107+
108+ // shareProto is the file system protocol.
109+ // +kubebuilder:validation:MaxLength=1024
110+ // +optional
111+ ShareProto string `json:"shareProto,omitempty"`
112+
113+ // status represents the current status of the share.
114+ // +kubebuilder:validation:MaxLength=1024
115+ // +optional
116+ Status string `json:"status,omitempty"`
117+
118+ // availabilityZone is which availability zone the share is in.
119+ // +kubebuilder:validation:MaxLength=1024
120+ // +optional
121+ AvailabilityZone string `json:"availabilityZone,omitempty"`
122+
123+ // exportLocations contains paths for accessing the share.
124+ // +kubebuilder:validation:MaxItems:=32
125+ // +listType=atomic
126+ // +optional
127+ ExportLocations []ShareExportLocation `json:"exportLocations,omitempty"`
128+
129+ // metadata key and value pairs associated with the share.
130+ // +kubebuilder:validation:MaxItems:=64
131+ // +listType=atomic
132+ // +optional
133+ Metadata []ShareMetadataStatus `json:"metadata,omitempty"`
134+
135+ // isPublic indicates whether the share is publicly visible.
136+ // +optional
137+ IsPublic * bool `json:"isPublic,omitempty"`
138+
139+ // createdAt shows the date and time when the resource was created. The date and time stamp format is ISO 8601.
140+ // +optional
141+ CreatedAt * metav1.Time `json:"createdAt,omitempty"`
142+
143+ // projectID is the ID of the project that owns the share.
144+ // +kubebuilder:validation:MaxLength=1024
145+ // +optional
146+ ProjectID string `json:"projectID,omitempty"`
147+ }
148+
149+ type ShareMetadata struct {
150+ // name is the name of the metadata
151+ // +kubebuilder:validation:MaxLength:=255
152+ // +required
153+ Name string `json:"name"`
154+
155+ // value is the value of the metadata
156+ // +kubebuilder:validation:MaxLength:=255
157+ // +required
158+ Value string `json:"value"`
159+ }
160+
161+ type ShareMetadataStatus struct {
162+ // name is the name of the metadata
163+ // +kubebuilder:validation:MaxLength:=255
164+ // +optional
165+ Name string `json:"name,omitempty"`
166+
167+ // value is the value of the metadata
168+ // +kubebuilder:validation:MaxLength:=255
169+ // +optional
170+ Value string `json:"value,omitempty"`
171+ }
172+
173+ type ShareExportLocation struct {
174+ // path is the export path for accessing the share
175+ // +kubebuilder:validation:MaxLength:=1024
176+ // +optional
177+ Path string `json:"path,omitempty"`
178+
179+ // preferred indicates if this is the preferred export location
180+ // +optional
181+ Preferred * bool `json:"preferred,omitempty"`
74182}
0 commit comments