diff --git a/PROJECT b/PROJECT
index e5a188a8b..d62235534 100644
--- a/PROJECT
+++ b/PROJECT
@@ -168,6 +168,14 @@ resources:
kind: ShareNetwork
path: github.com/k-orc/openstack-resource-controller/api/v1alpha1
version: v1alpha1
+- api:
+ crdVersion: v1
+ namespaced: true
+ domain: k-orc.cloud
+ group: openstack
+ kind: ShareType
+ path: github.com/k-orc/openstack-resource-controller/api/v1alpha1
+ version: v1alpha1
- api:
crdVersion: v1
namespaced: true
diff --git a/api/v1alpha1/sharetype_types.go b/api/v1alpha1/sharetype_types.go
new file mode 100644
index 000000000..e3c382d02
--- /dev/null
+++ b/api/v1alpha1/sharetype_types.go
@@ -0,0 +1,70 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package v1alpha1
+
+// ShareTypeResourceSpec contains the desired state of the resource.
+// All fields are immutable after creation.
+// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="ShareTypeResourceSpec is immutable"
+type ShareTypeResourceSpec struct {
+ // name will be the name of the created resource. If not specified, the
+ // name of the ORC object will be used.
+ // +optional
+ Name *OpenStackName `json:"name,omitempty"`
+
+ // isPublic indicates whether a share type is publicly accessible.
+ // +kubebuilder:default:=true
+ // +optional
+ IsPublic *bool `json:"isPublic,omitempty"`
+
+ // driverHandlesShareServers defines the driver mode for share server, or storage, life cycle management.
+ // This is a required extra specification for share types.
+ // +kubebuilder:default:=true
+ // +optional
+ DriverHandlesShareServers *bool `json:"driverHandlesShareServers,omitempty"`
+
+ // snapshotSupport filters back ends by whether they do or do not support share snapshots.
+ // +optional
+ SnapshotSupport *bool `json:"snapshotSupport,omitempty"`
+}
+
+// ShareTypeFilter defines an existing resource by its properties
+// +kubebuilder:validation:MinProperties:=1
+type ShareTypeFilter struct {
+ // name of the existing resource
+ // +optional
+ Name *OpenStackName `json:"name,omitempty"`
+
+ // isPublic selects public types, private types, or both
+ // +optional
+ IsPublic *bool `json:"isPublic,omitempty"`
+}
+
+// ShareTypeResourceStatus represents the observed state of the resource.
+type ShareTypeResourceStatus struct {
+ // name is a Human-readable name for the resource. Might not be unique.
+ // +kubebuilder:validation:MaxLength=1024
+ // +optional
+ Name string `json:"name,omitempty"`
+
+ // isPublic indicates whether a share type is publicly accessible.
+ // +optional
+ IsPublic bool `json:"isPublic,omitempty"`
+
+ // extraSpecs contains the extra specifications for the share type.
+ // +optional
+ ExtraSpecs map[string]string `json:"extraSpecs,omitempty"`
+}
diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go
index ead3ef708..f2e92768e 100644
--- a/api/v1alpha1/zz_generated.deepcopy.go
+++ b/api/v1alpha1/zz_generated.deepcopy.go
@@ -5839,6 +5839,235 @@ func (in *ShareNetworkStatus) DeepCopy() *ShareNetworkStatus {
return out
}
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ShareType) DeepCopyInto(out *ShareType) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
+ in.Spec.DeepCopyInto(&out.Spec)
+ in.Status.DeepCopyInto(&out.Status)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShareType.
+func (in *ShareType) DeepCopy() *ShareType {
+ if in == nil {
+ return nil
+ }
+ out := new(ShareType)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *ShareType) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ShareTypeFilter) DeepCopyInto(out *ShareTypeFilter) {
+ *out = *in
+ if in.Name != nil {
+ in, out := &in.Name, &out.Name
+ *out = new(OpenStackName)
+ **out = **in
+ }
+ if in.IsPublic != nil {
+ in, out := &in.IsPublic, &out.IsPublic
+ *out = new(bool)
+ **out = **in
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShareTypeFilter.
+func (in *ShareTypeFilter) DeepCopy() *ShareTypeFilter {
+ if in == nil {
+ return nil
+ }
+ out := new(ShareTypeFilter)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ShareTypeImport) DeepCopyInto(out *ShareTypeImport) {
+ *out = *in
+ if in.ID != nil {
+ in, out := &in.ID, &out.ID
+ *out = new(string)
+ **out = **in
+ }
+ if in.Filter != nil {
+ in, out := &in.Filter, &out.Filter
+ *out = new(ShareTypeFilter)
+ (*in).DeepCopyInto(*out)
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShareTypeImport.
+func (in *ShareTypeImport) DeepCopy() *ShareTypeImport {
+ if in == nil {
+ return nil
+ }
+ out := new(ShareTypeImport)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ShareTypeList) DeepCopyInto(out *ShareTypeList) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ListMeta.DeepCopyInto(&out.ListMeta)
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]ShareType, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShareTypeList.
+func (in *ShareTypeList) DeepCopy() *ShareTypeList {
+ if in == nil {
+ return nil
+ }
+ out := new(ShareTypeList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *ShareTypeList) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ShareTypeResourceSpec) DeepCopyInto(out *ShareTypeResourceSpec) {
+ *out = *in
+ if in.Name != nil {
+ in, out := &in.Name, &out.Name
+ *out = new(OpenStackName)
+ **out = **in
+ }
+ if in.IsPublic != nil {
+ in, out := &in.IsPublic, &out.IsPublic
+ *out = new(bool)
+ **out = **in
+ }
+ if in.DriverHandlesShareServers != nil {
+ in, out := &in.DriverHandlesShareServers, &out.DriverHandlesShareServers
+ *out = new(bool)
+ **out = **in
+ }
+ if in.SnapshotSupport != nil {
+ in, out := &in.SnapshotSupport, &out.SnapshotSupport
+ *out = new(bool)
+ **out = **in
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShareTypeResourceSpec.
+func (in *ShareTypeResourceSpec) DeepCopy() *ShareTypeResourceSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(ShareTypeResourceSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ShareTypeResourceStatus) DeepCopyInto(out *ShareTypeResourceStatus) {
+ *out = *in
+ if in.ExtraSpecs != nil {
+ in, out := &in.ExtraSpecs, &out.ExtraSpecs
+ *out = make(map[string]string, len(*in))
+ for key, val := range *in {
+ (*out)[key] = val
+ }
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShareTypeResourceStatus.
+func (in *ShareTypeResourceStatus) DeepCopy() *ShareTypeResourceStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(ShareTypeResourceStatus)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ShareTypeSpec) DeepCopyInto(out *ShareTypeSpec) {
+ *out = *in
+ if in.Import != nil {
+ in, out := &in.Import, &out.Import
+ *out = new(ShareTypeImport)
+ (*in).DeepCopyInto(*out)
+ }
+ if in.Resource != nil {
+ in, out := &in.Resource, &out.Resource
+ *out = new(ShareTypeResourceSpec)
+ (*in).DeepCopyInto(*out)
+ }
+ if in.ManagedOptions != nil {
+ in, out := &in.ManagedOptions, &out.ManagedOptions
+ *out = new(ManagedOptions)
+ **out = **in
+ }
+ out.CloudCredentialsRef = in.CloudCredentialsRef
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShareTypeSpec.
+func (in *ShareTypeSpec) DeepCopy() *ShareTypeSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(ShareTypeSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ShareTypeStatus) DeepCopyInto(out *ShareTypeStatus) {
+ *out = *in
+ if in.Conditions != nil {
+ in, out := &in.Conditions, &out.Conditions
+ *out = make([]v1.Condition, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ if in.ID != nil {
+ in, out := &in.ID, &out.ID
+ *out = new(string)
+ **out = **in
+ }
+ if in.Resource != nil {
+ in, out := &in.Resource, &out.Resource
+ *out = new(ShareTypeResourceStatus)
+ (*in).DeepCopyInto(*out)
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShareTypeStatus.
+func (in *ShareTypeStatus) DeepCopy() *ShareTypeStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(ShareTypeStatus)
+ in.DeepCopyInto(out)
+ return out
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Subnet) DeepCopyInto(out *Subnet) {
*out = *in
diff --git a/api/v1alpha1/zz_generated.sharetype-resource.go b/api/v1alpha1/zz_generated.sharetype-resource.go
new file mode 100644
index 000000000..28d127918
--- /dev/null
+++ b/api/v1alpha1/zz_generated.sharetype-resource.go
@@ -0,0 +1,179 @@
+// Code generated by resource-generator. DO NOT EDIT.
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package v1alpha1
+
+import (
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
+
+// ShareTypeImport specifies an existing resource which will be imported instead of
+// creating a new one
+// +kubebuilder:validation:MinProperties:=1
+// +kubebuilder:validation:MaxProperties:=1
+type ShareTypeImport struct {
+ // id contains the unique identifier of an existing OpenStack resource. Note
+ // that when specifying an import by ID, the resource MUST already exist.
+ // The ORC object will enter an error state if the resource does not exist.
+ // +kubebuilder:validation:Format:=uuid
+ // +kubebuilder:validation:MaxLength:=36
+ // +optional
+ ID *string `json:"id,omitempty"` //nolint:kubeapilinter
+
+ // filter contains a resource query which is expected to return a single
+ // result. The controller will continue to retry if filter returns no
+ // results. If filter returns multiple results the controller will set an
+ // error state and will not continue to retry.
+ // +optional
+ Filter *ShareTypeFilter `json:"filter,omitempty"`
+}
+
+// ShareTypeSpec defines the desired state of an ORC object.
+// +kubebuilder:validation:XValidation:rule="self.managementPolicy == 'managed' ? has(self.resource) : true",message="resource must be specified when policy is managed"
+// +kubebuilder:validation:XValidation:rule="self.managementPolicy == 'managed' ? !has(self.__import__) : true",message="import may not be specified when policy is managed"
+// +kubebuilder:validation:XValidation:rule="self.managementPolicy == 'unmanaged' ? !has(self.resource) : true",message="resource may not be specified when policy is unmanaged"
+// +kubebuilder:validation:XValidation:rule="self.managementPolicy == 'unmanaged' ? has(self.__import__) : true",message="import must be specified when policy is unmanaged"
+// +kubebuilder:validation:XValidation:rule="has(self.managedOptions) ? self.managementPolicy == 'managed' : true",message="managedOptions may only be provided when policy is managed"
+type ShareTypeSpec struct {
+ // import refers to an existing OpenStack resource which will be imported instead of
+ // creating a new one.
+ // +optional
+ Import *ShareTypeImport `json:"import,omitempty"`
+
+ // resource specifies the desired state of the resource.
+ //
+ // resource may not be specified if the management policy is `unmanaged`.
+ //
+ // resource must be specified if the management policy is `managed`.
+ // +optional
+ Resource *ShareTypeResourceSpec `json:"resource,omitempty"`
+
+ // managementPolicy defines how ORC will treat the object. Valid values are
+ // `managed`: ORC will create, update, and delete the resource; `unmanaged`:
+ // ORC will import an existing resource, and will not apply updates to it or
+ // delete it.
+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="managementPolicy is immutable"
+ // +kubebuilder:default:=managed
+ // +optional
+ ManagementPolicy ManagementPolicy `json:"managementPolicy,omitempty"`
+
+ // managedOptions specifies options which may be applied to managed objects.
+ // +optional
+ ManagedOptions *ManagedOptions `json:"managedOptions,omitempty"`
+
+ // cloudCredentialsRef points to a secret containing OpenStack credentials
+ // +required
+ CloudCredentialsRef CloudCredentialsReference `json:"cloudCredentialsRef,omitzero"`
+}
+
+// ShareTypeStatus defines the observed state of an ORC resource.
+type ShareTypeStatus struct {
+ // conditions represents the observed status of the object.
+ // Known .status.conditions.type are: "Available", "Progressing"
+ //
+ // Available represents the availability of the OpenStack resource. If it is
+ // true then the resource is ready for use.
+ //
+ // Progressing indicates whether the controller is still attempting to
+ // reconcile the current state of the OpenStack resource to the desired
+ // state. Progressing will be False either because the desired state has
+ // been achieved, or because some terminal error prevents it from ever being
+ // achieved and the controller is no longer attempting to reconcile. If
+ // Progressing is True, an observer waiting on the resource should continue
+ // to wait.
+ //
+ // +kubebuilder:validation:MaxItems:=32
+ // +patchMergeKey=type
+ // +patchStrategy=merge
+ // +listType=map
+ // +listMapKey=type
+ // +optional
+ Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
+
+ // id is the unique identifier of the OpenStack resource.
+ // +kubebuilder:validation:MaxLength:=1024
+ // +optional
+ ID *string `json:"id,omitempty"`
+
+ // resource contains the observed state of the OpenStack resource.
+ // +optional
+ Resource *ShareTypeResourceStatus `json:"resource,omitempty"`
+}
+
+var _ ObjectWithConditions = &ShareType{}
+
+func (i *ShareType) GetConditions() []metav1.Condition {
+ return i.Status.Conditions
+}
+
+// +genclient
+// +kubebuilder:object:root=true
+// +kubebuilder:resource:categories=openstack
+// +kubebuilder:subresource:status
+// +kubebuilder:printcolumn:name="ID",type="string",JSONPath=".status.id",description="Resource ID"
+// +kubebuilder:printcolumn:name="Available",type="string",JSONPath=".status.conditions[?(@.type=='Available')].status",description="Availability status of resource"
+// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Progressing')].message",description="Message describing current progress status"
+
+// ShareType is the Schema for an ORC resource.
+type ShareType struct {
+ metav1.TypeMeta `json:",inline"`
+
+ // metadata contains the object metadata
+ // +optional
+ metav1.ObjectMeta `json:"metadata,omitempty"`
+
+ // spec specifies the desired state of the resource.
+ // +required
+ Spec ShareTypeSpec `json:"spec,omitzero"`
+
+ // status defines the observed state of the resource.
+ // +optional
+ Status ShareTypeStatus `json:"status,omitempty"`
+}
+
+// +kubebuilder:object:root=true
+
+// ShareTypeList contains a list of ShareType.
+type ShareTypeList struct {
+ metav1.TypeMeta `json:",inline"`
+
+ // metadata contains the list metadata
+ // +optional
+ metav1.ListMeta `json:"metadata,omitempty"`
+
+ // items contains a list of ShareType.
+ // +required
+ Items []ShareType `json:"items"`
+}
+
+func (l *ShareTypeList) GetItems() []ShareType {
+ return l.Items
+}
+
+func init() {
+ SchemeBuilder.Register(&ShareType{}, &ShareTypeList{})
+}
+
+func (i *ShareType) GetCloudCredentialsRef() (*string, *CloudCredentialsReference) {
+ if i == nil {
+ return nil, nil
+ }
+
+ return &i.Namespace, &i.Spec.CloudCredentialsRef
+}
+
+var _ CloudCredentialsRefProvider = &ShareType{}
diff --git a/cmd/manager/main.go b/cmd/manager/main.go
index 9addc552d..9d42439dc 100644
--- a/cmd/manager/main.go
+++ b/cmd/manager/main.go
@@ -48,6 +48,7 @@ import (
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/servergroup"
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/service"
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/sharenetwork"
+ "github.com/k-orc/openstack-resource-controller/v2/internal/controllers/sharetype"
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/subnet"
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/trunk"
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/user"
@@ -135,6 +136,7 @@ func main() {
domain.New(scopeFactory),
service.New(scopeFactory),
sharenetwork.New(scopeFactory),
+ sharetype.New(scopeFactory),
keypair.New(scopeFactory),
group.New(scopeFactory),
role.New(scopeFactory),
diff --git a/cmd/models-schema/zz_generated.openapi.go b/cmd/models-schema/zz_generated.openapi.go
index 8960fadc4..d9a2fd425 100644
--- a/cmd/models-schema/zz_generated.openapi.go
+++ b/cmd/models-schema/zz_generated.openapi.go
@@ -231,6 +231,14 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
"github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareNetworkResourceStatus": schema_openstack_resource_controller_v2_api_v1alpha1_ShareNetworkResourceStatus(ref),
"github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareNetworkSpec": schema_openstack_resource_controller_v2_api_v1alpha1_ShareNetworkSpec(ref),
"github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareNetworkStatus": schema_openstack_resource_controller_v2_api_v1alpha1_ShareNetworkStatus(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareType": schema_openstack_resource_controller_v2_api_v1alpha1_ShareType(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeFilter": schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeFilter(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeImport": schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeImport(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeList": schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeList(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeResourceSpec": schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeResourceSpec(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeResourceStatus": schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeResourceStatus(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeSpec": schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeSpec(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeStatus": schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeStatus(ref),
"github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.Subnet": schema_openstack_resource_controller_v2_api_v1alpha1_Subnet(ref),
"github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.SubnetFilter": schema_openstack_resource_controller_v2_api_v1alpha1_SubnetFilter(ref),
"github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.SubnetGateway": schema_openstack_resource_controller_v2_api_v1alpha1_SubnetGateway(ref),
@@ -10964,6 +10972,347 @@ func schema_openstack_resource_controller_v2_api_v1alpha1_ShareNetworkStatus(ref
}
}
+func schema_openstack_resource_controller_v2_api_v1alpha1_ShareType(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "ShareType is the Schema for an ORC resource.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "kind": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "apiVersion": {
+ SchemaProps: spec.SchemaProps{
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "metadata": {
+ SchemaProps: spec.SchemaProps{
+ Description: "metadata contains the object metadata",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
+ },
+ },
+ "spec": {
+ SchemaProps: spec.SchemaProps{
+ Description: "spec specifies the desired state of the resource.",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeSpec"),
+ },
+ },
+ "status": {
+ SchemaProps: spec.SchemaProps{
+ Description: "status defines the observed state of the resource.",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeStatus"),
+ },
+ },
+ },
+ Required: []string{"spec"},
+ },
+ },
+ Dependencies: []string{
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeSpec", "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeFilter(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "ShareTypeFilter defines an existing resource by its properties",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "name": {
+ SchemaProps: spec.SchemaProps{
+ Description: "name of the existing resource",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "isPublic": {
+ SchemaProps: spec.SchemaProps{
+ Description: "isPublic selects public types, private types, or both",
+ Type: []string{"boolean"},
+ Format: "",
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeImport(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "ShareTypeImport specifies an existing resource which will be imported instead of creating a new one",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "id": {
+ SchemaProps: spec.SchemaProps{
+ Description: "id contains the unique identifier of an existing OpenStack resource. Note that when specifying an import by ID, the resource MUST already exist. The ORC object will enter an error state if the resource does not exist.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "filter": {
+ SchemaProps: spec.SchemaProps{
+ Description: "filter contains a resource query which is expected to return a single result. The controller will continue to retry if filter returns no results. If filter returns multiple results the controller will set an error state and will not continue to retry.",
+ Ref: ref("github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeFilter"),
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeFilter"},
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeList(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "ShareTypeList contains a list of ShareType.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "kind": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "apiVersion": {
+ SchemaProps: spec.SchemaProps{
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "metadata": {
+ SchemaProps: spec.SchemaProps{
+ Description: "metadata contains the list metadata",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
+ },
+ },
+ "items": {
+ SchemaProps: spec.SchemaProps{
+ Description: "items contains a list of ShareType.",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareType"),
+ },
+ },
+ },
+ },
+ },
+ },
+ Required: []string{"items"},
+ },
+ },
+ Dependencies: []string{
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareType", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeResourceSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "ShareTypeResourceSpec contains the desired state of the resource. All fields are immutable after creation.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "name": {
+ SchemaProps: spec.SchemaProps{
+ Description: "name will be the name of the created resource. If not specified, the name of the ORC object will be used.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "isPublic": {
+ SchemaProps: spec.SchemaProps{
+ Description: "isPublic indicates whether a share type is publicly accessible.",
+ Type: []string{"boolean"},
+ Format: "",
+ },
+ },
+ "driverHandlesShareServers": {
+ SchemaProps: spec.SchemaProps{
+ Description: "driverHandlesShareServers defines the driver mode for share server, or storage, life cycle management. This is a required extra specification for share types.",
+ Type: []string{"boolean"},
+ Format: "",
+ },
+ },
+ "snapshotSupport": {
+ SchemaProps: spec.SchemaProps{
+ Description: "snapshotSupport filters back ends by whether they do or do not support share snapshots.",
+ Type: []string{"boolean"},
+ Format: "",
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeResourceStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "ShareTypeResourceStatus represents the observed state of the resource.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "name": {
+ SchemaProps: spec.SchemaProps{
+ Description: "name is a Human-readable name for the resource. Might not be unique.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "isPublic": {
+ SchemaProps: spec.SchemaProps{
+ Description: "isPublic indicates whether a share type is publicly accessible.",
+ Type: []string{"boolean"},
+ Format: "",
+ },
+ },
+ "extraSpecs": {
+ SchemaProps: spec.SchemaProps{
+ Description: "extraSpecs contains the extra specifications for the share type.",
+ Type: []string{"object"},
+ AdditionalProperties: &spec.SchemaOrBool{
+ Allows: true,
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "ShareTypeSpec defines the desired state of an ORC object.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "import": {
+ SchemaProps: spec.SchemaProps{
+ Description: "import refers to an existing OpenStack resource which will be imported instead of creating a new one.",
+ Ref: ref("github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeImport"),
+ },
+ },
+ "resource": {
+ SchemaProps: spec.SchemaProps{
+ Description: "resource specifies the desired state of the resource.\n\nresource may not be specified if the management policy is `unmanaged`.\n\nresource must be specified if the management policy is `managed`.",
+ Ref: ref("github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeResourceSpec"),
+ },
+ },
+ "managementPolicy": {
+ SchemaProps: spec.SchemaProps{
+ Description: "managementPolicy defines how ORC will treat the object. Valid values are `managed`: ORC will create, update, and delete the resource; `unmanaged`: ORC will import an existing resource, and will not apply updates to it or delete it.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "managedOptions": {
+ SchemaProps: spec.SchemaProps{
+ Description: "managedOptions specifies options which may be applied to managed objects.",
+ Ref: ref("github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ManagedOptions"),
+ },
+ },
+ "cloudCredentialsRef": {
+ SchemaProps: spec.SchemaProps{
+ Description: "cloudCredentialsRef points to a secret containing OpenStack credentials",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.CloudCredentialsReference"),
+ },
+ },
+ },
+ Required: []string{"cloudCredentialsRef"},
+ },
+ },
+ Dependencies: []string{
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.CloudCredentialsReference", "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ManagedOptions", "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeImport", "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeResourceSpec"},
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_ShareTypeStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "ShareTypeStatus defines the observed state of an ORC resource.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "conditions": {
+ VendorExtensible: spec.VendorExtensible{
+ Extensions: spec.Extensions{
+ "x-kubernetes-list-map-keys": []interface{}{
+ "type",
+ },
+ "x-kubernetes-list-type": "map",
+ "x-kubernetes-patch-merge-key": "type",
+ "x-kubernetes-patch-strategy": "merge",
+ },
+ },
+ SchemaProps: spec.SchemaProps{
+ Description: "conditions represents the observed status of the object. Known .status.conditions.type are: \"Available\", \"Progressing\"\n\nAvailable represents the availability of the OpenStack resource. If it is true then the resource is ready for use.\n\nProgressing indicates whether the controller is still attempting to reconcile the current state of the OpenStack resource to the desired state. Progressing will be False either because the desired state has been achieved, or because some terminal error prevents it from ever being achieved and the controller is no longer attempting to reconcile. If Progressing is True, an observer waiting on the resource should continue to wait.",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"),
+ },
+ },
+ },
+ },
+ },
+ "id": {
+ SchemaProps: spec.SchemaProps{
+ Description: "id is the unique identifier of the OpenStack resource.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "resource": {
+ SchemaProps: spec.SchemaProps{
+ Description: "resource contains the observed state of the OpenStack resource.",
+ Ref: ref("github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeResourceStatus"),
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.ShareTypeResourceStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"},
+ }
+}
+
func schema_openstack_resource_controller_v2_api_v1alpha1_Subnet(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
diff --git a/cmd/resource-generator/main.go b/cmd/resource-generator/main.go
index 609bf9084..bf336b3a9 100644
--- a/cmd/resource-generator/main.go
+++ b/cmd/resource-generator/main.go
@@ -163,6 +163,9 @@ var resources []templateFields = []templateFields{
{
Name: "ShareNetwork",
},
+ {
+ Name: "ShareType",
+ },
{
Name: "KeyPair",
UsesNameAsID: true, // Keypairs uses name as ID, not UUID
diff --git a/config/crd/bases/openstack.k-orc.cloud_sharetypes.yaml b/config/crd/bases/openstack.k-orc.cloud_sharetypes.yaml
new file mode 100644
index 000000000..273a842fe
--- /dev/null
+++ b/config/crd/bases/openstack.k-orc.cloud_sharetypes.yaml
@@ -0,0 +1,305 @@
+---
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ annotations:
+ controller-gen.kubebuilder.io/version: v0.20.1
+ name: sharetypes.openstack.k-orc.cloud
+spec:
+ group: openstack.k-orc.cloud
+ names:
+ categories:
+ - openstack
+ kind: ShareType
+ listKind: ShareTypeList
+ plural: sharetypes
+ singular: sharetype
+ scope: Namespaced
+ versions:
+ - additionalPrinterColumns:
+ - description: Resource ID
+ jsonPath: .status.id
+ name: ID
+ type: string
+ - description: Availability status of resource
+ jsonPath: .status.conditions[?(@.type=='Available')].status
+ name: Available
+ type: string
+ - description: Message describing current progress status
+ jsonPath: .status.conditions[?(@.type=='Progressing')].message
+ name: Message
+ type: string
+ name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ description: ShareType is the Schema for an ORC resource.
+ properties:
+ apiVersion:
+ description: |-
+ APIVersion defines the versioned schema of this representation of an object.
+ Servers should convert recognized schemas to the latest internal value, and
+ may reject unrecognized values.
+ More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
+ type: string
+ kind:
+ description: |-
+ Kind is a string value representing the REST resource this object represents.
+ Servers may infer this from the endpoint the client submits requests to.
+ Cannot be updated.
+ In CamelCase.
+ More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
+ type: string
+ metadata:
+ type: object
+ spec:
+ description: spec specifies the desired state of the resource.
+ properties:
+ cloudCredentialsRef:
+ description: cloudCredentialsRef points to a secret containing OpenStack
+ credentials
+ properties:
+ cloudName:
+ description: cloudName specifies the name of the entry in the
+ clouds.yaml file to use.
+ maxLength: 256
+ minLength: 1
+ type: string
+ secretName:
+ description: |-
+ secretName is the name of a secret in the same namespace as the resource being provisioned.
+ The secret must contain a key named `clouds.yaml` which contains an OpenStack clouds.yaml file.
+ The secret may optionally contain a key named `cacert` containing a PEM-encoded CA certificate.
+ maxLength: 253
+ minLength: 1
+ type: string
+ required:
+ - cloudName
+ - secretName
+ type: object
+ import:
+ description: |-
+ import refers to an existing OpenStack resource which will be imported instead of
+ creating a new one.
+ maxProperties: 1
+ minProperties: 1
+ properties:
+ filter:
+ description: |-
+ filter contains a resource query which is expected to return a single
+ result. The controller will continue to retry if filter returns no
+ results. If filter returns multiple results the controller will set an
+ error state and will not continue to retry.
+ minProperties: 1
+ properties:
+ isPublic:
+ description: isPublic selects public types, private types,
+ or both
+ type: boolean
+ name:
+ description: name of the existing resource
+ maxLength: 255
+ minLength: 1
+ pattern: ^[^,]+$
+ type: string
+ type: object
+ id:
+ description: |-
+ id contains the unique identifier of an existing OpenStack resource. Note
+ that when specifying an import by ID, the resource MUST already exist.
+ The ORC object will enter an error state if the resource does not exist.
+ format: uuid
+ maxLength: 36
+ type: string
+ type: object
+ managedOptions:
+ description: managedOptions specifies options which may be applied
+ to managed objects.
+ properties:
+ onDelete:
+ default: delete
+ description: |-
+ onDelete specifies the behaviour of the controller when the ORC
+ object is deleted. Options are `delete` - delete the OpenStack resource;
+ `detach` - do not delete the OpenStack resource. If not specified, the
+ default is `delete`.
+ enum:
+ - delete
+ - detach
+ type: string
+ type: object
+ managementPolicy:
+ default: managed
+ description: |-
+ managementPolicy defines how ORC will treat the object. Valid values are
+ `managed`: ORC will create, update, and delete the resource; `unmanaged`:
+ ORC will import an existing resource, and will not apply updates to it or
+ delete it.
+ enum:
+ - managed
+ - unmanaged
+ type: string
+ x-kubernetes-validations:
+ - message: managementPolicy is immutable
+ rule: self == oldSelf
+ resource:
+ description: |-
+ resource specifies the desired state of the resource.
+
+ resource may not be specified if the management policy is `unmanaged`.
+
+ resource must be specified if the management policy is `managed`.
+ properties:
+ driverHandlesShareServers:
+ default: true
+ description: |-
+ driverHandlesShareServers defines the driver mode for share server, or storage, life cycle management.
+ This is a required extra specification for share types.
+ type: boolean
+ isPublic:
+ default: true
+ description: isPublic indicates whether a share type is publicly
+ accessible.
+ type: boolean
+ name:
+ description: |-
+ name will be the name of the created resource. If not specified, the
+ name of the ORC object will be used.
+ maxLength: 255
+ minLength: 1
+ pattern: ^[^,]+$
+ type: string
+ snapshotSupport:
+ description: snapshotSupport filters back ends by whether they
+ do or do not support share snapshots.
+ type: boolean
+ type: object
+ x-kubernetes-validations:
+ - message: ShareTypeResourceSpec is immutable
+ rule: self == oldSelf
+ required:
+ - cloudCredentialsRef
+ type: object
+ x-kubernetes-validations:
+ - message: resource must be specified when policy is managed
+ rule: 'self.managementPolicy == ''managed'' ? has(self.resource) : true'
+ - message: import may not be specified when policy is managed
+ rule: 'self.managementPolicy == ''managed'' ? !has(self.__import__)
+ : true'
+ - message: resource may not be specified when policy is unmanaged
+ rule: 'self.managementPolicy == ''unmanaged'' ? !has(self.resource)
+ : true'
+ - message: import must be specified when policy is unmanaged
+ rule: 'self.managementPolicy == ''unmanaged'' ? has(self.__import__)
+ : true'
+ - message: managedOptions may only be provided when policy is managed
+ rule: 'has(self.managedOptions) ? self.managementPolicy == ''managed''
+ : true'
+ status:
+ description: status defines the observed state of the resource.
+ properties:
+ conditions:
+ description: |-
+ conditions represents the observed status of the object.
+ Known .status.conditions.type are: "Available", "Progressing"
+
+ Available represents the availability of the OpenStack resource. If it is
+ true then the resource is ready for use.
+
+ Progressing indicates whether the controller is still attempting to
+ reconcile the current state of the OpenStack resource to the desired
+ state. Progressing will be False either because the desired state has
+ been achieved, or because some terminal error prevents it from ever being
+ achieved and the controller is no longer attempting to reconcile. If
+ Progressing is True, an observer waiting on the resource should continue
+ to wait.
+ items:
+ description: Condition contains details for one aspect of the current
+ state of this API Resource.
+ properties:
+ lastTransitionTime:
+ description: |-
+ lastTransitionTime is the last time the condition transitioned from one status to another.
+ This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
+ format: date-time
+ type: string
+ message:
+ description: |-
+ message is a human readable message indicating details about the transition.
+ This may be an empty string.
+ maxLength: 32768
+ type: string
+ observedGeneration:
+ description: |-
+ observedGeneration represents the .metadata.generation that the condition was set based upon.
+ For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
+ with respect to the current state of the instance.
+ format: int64
+ minimum: 0
+ type: integer
+ reason:
+ description: |-
+ reason contains a programmatic identifier indicating the reason for the condition's last transition.
+ Producers of specific condition types may define expected values and meanings for this field,
+ and whether the values are considered a guaranteed API.
+ The value should be a CamelCase string.
+ This field may not be empty.
+ maxLength: 1024
+ minLength: 1
+ pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
+ type: string
+ status:
+ description: status of the condition, one of True, False, Unknown.
+ enum:
+ - "True"
+ - "False"
+ - Unknown
+ type: string
+ type:
+ description: type of condition in CamelCase or in foo.example.com/CamelCase.
+ maxLength: 316
+ pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
+ type: string
+ required:
+ - lastTransitionTime
+ - message
+ - reason
+ - status
+ - type
+ type: object
+ maxItems: 32
+ type: array
+ x-kubernetes-list-map-keys:
+ - type
+ x-kubernetes-list-type: map
+ id:
+ description: id is the unique identifier of the OpenStack resource.
+ maxLength: 1024
+ type: string
+ resource:
+ description: resource contains the observed state of the OpenStack
+ resource.
+ properties:
+ extraSpecs:
+ additionalProperties:
+ type: string
+ description: extraSpecs contains the extra specifications for
+ the share type.
+ type: object
+ isPublic:
+ description: isPublic indicates whether a share type is publicly
+ accessible.
+ type: boolean
+ name:
+ description: name is a Human-readable name for the resource. Might
+ not be unique.
+ maxLength: 1024
+ type: string
+ type: object
+ type: object
+ required:
+ - spec
+ type: object
+ served: true
+ storage: true
+ subresources:
+ status: {}
diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml
index 26b47f63f..880337ad1 100644
--- a/config/crd/kustomization.yaml
+++ b/config/crd/kustomization.yaml
@@ -23,6 +23,7 @@ resources:
- bases/openstack.k-orc.cloud_servergroups.yaml
- bases/openstack.k-orc.cloud_services.yaml
- bases/openstack.k-orc.cloud_sharenetworks.yaml
+- bases/openstack.k-orc.cloud_sharetypes.yaml
- bases/openstack.k-orc.cloud_subnets.yaml
- bases/openstack.k-orc.cloud_trunks.yaml
- bases/openstack.k-orc.cloud_users.yaml
diff --git a/config/manifests/bases/orc.clusterserviceversion.yaml b/config/manifests/bases/orc.clusterserviceversion.yaml
index 742c646bc..1f56eebdf 100644
--- a/config/manifests/bases/orc.clusterserviceversion.yaml
+++ b/config/manifests/bases/orc.clusterserviceversion.yaml
@@ -19,6 +19,16 @@ spec:
apiservicedefinitions: {}
customresourcedefinitions:
owned:
+ - description: AddressScope is the Schema for an ORC resource.
+ displayName: Address Scope
+ kind: AddressScope
+ name: addressscopes.openstack.k-orc.cloud
+ version: v1alpha1
+ - description: ApplicationCredential is the Schema for an ORC resource.
+ displayName: Application Credential
+ kind: ApplicationCredential
+ name: applicationcredentials.openstack.k-orc.cloud
+ version: v1alpha1
- description: Domain is the Schema for an ORC resource.
displayName: Domain
kind: Domain
@@ -109,6 +119,11 @@ spec:
kind: ShareNetwork
name: sharenetworks.openstack.k-orc.cloud
version: v1alpha1
+ - description: ShareType is the Schema for an ORC resource.
+ displayName: Share Type
+ kind: ShareType
+ name: sharetypes.openstack.k-orc.cloud
+ version: v1alpha1
- description: Subnet is the Schema for an ORC resource.
displayName: Subnet
kind: Subnet
@@ -119,6 +134,11 @@ spec:
kind: Trunk
name: trunks.openstack.k-orc.cloud
version: v1alpha1
+ - description: User is the Schema for an ORC resource.
+ displayName: User
+ kind: User
+ name: users.openstack.k-orc.cloud
+ version: v1alpha1
- description: Volume is the Schema for an ORC resource.
displayName: Volume
kind: Volume
diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml
index 4991cff67..4defa67e5 100644
--- a/config/rbac/role.yaml
+++ b/config/rbac/role.yaml
@@ -37,6 +37,7 @@ rules:
- servers
- services
- sharenetworks
+ - sharetypes
- subnets
- trunks
- users
@@ -73,6 +74,7 @@ rules:
- servers/status
- services/status
- sharenetworks/status
+ - sharetypes/status
- subnets/status
- trunks/status
- users/status
diff --git a/config/samples/kustomization.yaml b/config/samples/kustomization.yaml
index 8a50ba039..3255c44d3 100644
--- a/config/samples/kustomization.yaml
+++ b/config/samples/kustomization.yaml
@@ -21,6 +21,7 @@ resources:
- openstack_v1alpha1_servergroup.yaml
- openstack_v1alpha1_service.yaml
- openstack_v1alpha1_sharenetwork.yaml
+- openstack_v1alpha1_sharetype.yaml
- openstack_v1alpha1_subnet.yaml
- openstack_v1alpha1_trunk.yaml
- openstack_v1alpha1_user.yaml
diff --git a/config/samples/openstack_v1alpha1_sharetype.yaml b/config/samples/openstack_v1alpha1_sharetype.yaml
new file mode 100644
index 000000000..32ee9800c
--- /dev/null
+++ b/config/samples/openstack_v1alpha1_sharetype.yaml
@@ -0,0 +1,73 @@
+---
+# Sample ShareType with all configuration options
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: ShareType
+metadata:
+ name: sharetype-sample
+spec:
+ cloudCredentialsRef:
+ # ShareTypes require admin credentials
+ cloudName: openstack-admin
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ # Optional: override the name in OpenStack (defaults to metadata.name)
+ name: my-share-type
+
+ # Optional: make the share type public (default: true)
+ # Set to false to create a private share type
+ isPublic: true
+
+ # Optional: determines if the storage backend manages share servers (default: true)
+ # true = driver handles share server lifecycle
+ # false = driver does not handle share servers (admin must configure)
+ driverHandlesShareServers: true
+
+ # Optional: indicates if the backend supports share snapshots
+ # When set, filters backends by snapshot support capability
+ snapshotSupport: true
+---
+# Example: Minimal ShareType (uses all defaults)
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: ShareType
+metadata:
+ name: sharetype-minimal
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack-admin
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource: {}
+---
+# Example: Private ShareType without DHSS
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: ShareType
+metadata:
+ name: sharetype-private
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack-admin
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ name: private-no-dhss
+ isPublic: false
+ driverHandlesShareServers: false
+---
+# Example: Import existing ShareType (unmanaged)
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: ShareType
+metadata:
+ name: sharetype-imported
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack-admin
+ secretName: openstack-clouds
+ # Use unmanaged to import existing resources
+ managementPolicy: unmanaged
+ import:
+ # Import by exact name
+ filter:
+ name: existing-share-type
+ # Optional: filter by public/private
+ isPublic: true
diff --git a/internal/controllers/sharetype/actuator.go b/internal/controllers/sharetype/actuator.go
new file mode 100644
index 000000000..e1019bfd1
--- /dev/null
+++ b/internal/controllers/sharetype/actuator.go
@@ -0,0 +1,214 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package sharetype
+
+import (
+ "context"
+ "iter"
+
+ "github.com/gophercloud/gophercloud/v2/openstack/sharedfilesystems/v2/sharetypes"
+ corev1 "k8s.io/api/core/v1"
+ "k8s.io/utils/ptr"
+ ctrl "sigs.k8s.io/controller-runtime"
+ "sigs.k8s.io/controller-runtime/pkg/client"
+
+ orcv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+ "github.com/k-orc/openstack-resource-controller/v2/internal/controllers/generic/interfaces"
+ "github.com/k-orc/openstack-resource-controller/v2/internal/controllers/generic/progress"
+ "github.com/k-orc/openstack-resource-controller/v2/internal/osclients"
+ orcerrors "github.com/k-orc/openstack-resource-controller/v2/internal/util/errors"
+)
+
+// OpenStack resource types
+type (
+ osResourceT = sharetypes.ShareType
+
+ createResourceActuator = interfaces.CreateResourceActuator[orcObjectPT, orcObjectT, filterT, osResourceT]
+ deleteResourceActuator = interfaces.DeleteResourceActuator[orcObjectPT, orcObjectT, osResourceT]
+ helperFactory = interfaces.ResourceHelperFactory[orcObjectPT, orcObjectT, resourceSpecT, filterT, osResourceT]
+)
+
+type sharetypeActuator struct {
+ osClient osclients.ShareTypeClient
+ k8sClient client.Client
+}
+
+var _ createResourceActuator = sharetypeActuator{}
+var _ deleteResourceActuator = sharetypeActuator{}
+
+func (sharetypeActuator) GetResourceID(osResource *osResourceT) string {
+ return osResource.ID
+}
+
+func (actuator sharetypeActuator) GetOSResourceByID(ctx context.Context, id string) (*osResourceT, progress.ReconcileStatus) {
+ // ShareTypes don't have a Get by ID API, so we list and filter
+ // We need to list without isPublic filter to get all share types (public + private)
+ listOpts := sharetypes.ListOpts{}
+ for shareType, err := range actuator.osClient.ListShareTypes(ctx, listOpts) {
+ if err != nil {
+ return nil, progress.WrapError(err)
+ }
+ if shareType.ID == id {
+ return shareType, nil
+ }
+ }
+ // Not found - return nil with no error so generic controller will attempt creation
+ return nil, nil
+}
+
+func (actuator sharetypeActuator) ListOSResourcesForAdoption(ctx context.Context, orcObject orcObjectPT) (iter.Seq2[*osResourceT, error], bool) {
+ resourceSpec := orcObject.Spec.Resource
+ if resourceSpec == nil {
+ return nil, false
+ }
+
+ listOpts := sharetypes.ListOpts{}
+
+ if resourceSpec.IsPublic != nil {
+ if *resourceSpec.IsPublic {
+ listOpts.IsPublic = "true"
+ } else {
+ listOpts.IsPublic = "false"
+ }
+ }
+
+ filters := make([]osclients.ResourceFilter[osResourceT], 0, 1)
+ filters = append(filters, func(st *sharetypes.ShareType) bool {
+ return st.Name == getResourceName(orcObject)
+ })
+
+ resources := actuator.osClient.ListShareTypes(ctx, listOpts)
+ return osclients.Filter(resources, filters...), true
+}
+
+func (actuator sharetypeActuator) ListOSResourcesForImport(ctx context.Context, obj orcObjectPT, filter filterT) (iter.Seq2[*osResourceT, error], progress.ReconcileStatus) {
+ listOpts := sharetypes.ListOpts{}
+
+ if filter.IsPublic != nil {
+ if *filter.IsPublic {
+ listOpts.IsPublic = "true"
+ } else {
+ listOpts.IsPublic = "false"
+ }
+ } else {
+ // When isPublic filter is not specified, list ALL share types (both public and private)
+ listOpts.IsPublic = "all"
+ }
+
+ var filters []osclients.ResourceFilter[osResourceT]
+ if filter.Name != nil {
+ name := string(*filter.Name)
+ filters = append(filters, func(st *sharetypes.ShareType) bool {
+ return st.Name == name
+ })
+ }
+
+ resources := actuator.osClient.ListShareTypes(ctx, listOpts)
+ return osclients.Filter(resources, filters...), nil
+}
+
+func (actuator sharetypeActuator) CreateResource(ctx context.Context, obj orcObjectPT) (*osResourceT, progress.ReconcileStatus) {
+ resource := obj.Spec.Resource
+
+ if resource == nil {
+ // Should have been caught by API validation
+ return nil, progress.WrapError(
+ orcerrors.Terminal(orcv1alpha1.ConditionReasonInvalidConfiguration, "Creation requested, but spec.resource is not set"))
+ }
+
+ // Build extra specs manually because gophercloud's ExtraSpecsOpts doesn't handle
+ // boolean false values correctly with the required:"true" tag
+ dhss := ptr.Deref(resource.DriverHandlesShareServers, true)
+ extraSpecsMap := map[string]interface{}{
+ "driver_handles_share_servers": dhss,
+ }
+ if resource.SnapshotSupport != nil {
+ extraSpecsMap["snapshot_support"] = *resource.SnapshotSupport
+ }
+
+ // Create custom CreateOpts with manually built extra specs
+ createOptsMap := map[string]interface{}{
+ "share_type": map[string]interface{}{
+ "name": getResourceName(obj),
+ "os-share-type-access:is_public": ptr.Deref(resource.IsPublic, true),
+ "extra_specs": extraSpecsMap,
+ },
+ }
+
+ osResource, err := actuator.osClient.CreateShareType(ctx, &customCreateOpts{optsMap: createOptsMap})
+ if err != nil {
+ if !orcerrors.IsRetryable(err) {
+ err = orcerrors.Terminal(orcv1alpha1.ConditionReasonInvalidConfiguration, "invalid configuration creating resource: "+err.Error(), err)
+ }
+ return nil, progress.WrapError(err)
+ }
+
+ return osResource, nil
+}
+
+// customCreateOpts implements CreateOptsBuilder to avoid gophercloud's BuildRequestBody issues with bool fields
+type customCreateOpts struct {
+ optsMap map[string]interface{}
+}
+
+func (opts *customCreateOpts) ToShareTypeCreateMap() (map[string]any, error) {
+ return opts.optsMap, nil
+}
+
+func (actuator sharetypeActuator) DeleteResource(ctx context.Context, _ orcObjectPT, resource *osResourceT) progress.ReconcileStatus {
+ return progress.WrapError(actuator.osClient.DeleteShareType(ctx, resource.ID))
+}
+
+type sharetypeHelperFactory struct{}
+
+var _ helperFactory = sharetypeHelperFactory{}
+
+func newActuator(ctx context.Context, orcObject *orcv1alpha1.ShareType, controller interfaces.ResourceController) (sharetypeActuator, progress.ReconcileStatus) {
+ log := ctrl.LoggerFrom(ctx)
+
+ // Ensure credential secrets exist and have our finalizer
+ _, reconcileStatus := credentialsDependency.GetDependencies(ctx, controller.GetK8sClient(), orcObject, func(*corev1.Secret) bool { return true })
+ if needsReschedule, _ := reconcileStatus.NeedsReschedule(); needsReschedule {
+ return sharetypeActuator{}, reconcileStatus
+ }
+
+ clientScope, err := controller.GetScopeFactory().NewClientScopeFromObject(ctx, controller.GetK8sClient(), log, orcObject)
+ if err != nil {
+ return sharetypeActuator{}, progress.WrapError(err)
+ }
+ osClient, err := clientScope.NewShareTypeClient()
+ if err != nil {
+ return sharetypeActuator{}, progress.WrapError(err)
+ }
+
+ return sharetypeActuator{
+ osClient: osClient,
+ k8sClient: controller.GetK8sClient(),
+ }, nil
+}
+
+func (sharetypeHelperFactory) NewAPIObjectAdapter(obj orcObjectPT) adapterI {
+ return sharetypeAdapter{obj}
+}
+
+func (sharetypeHelperFactory) NewCreateActuator(ctx context.Context, orcObject orcObjectPT, controller interfaces.ResourceController) (createResourceActuator, progress.ReconcileStatus) {
+ return newActuator(ctx, orcObject, controller)
+}
+
+func (sharetypeHelperFactory) NewDeleteActuator(ctx context.Context, orcObject orcObjectPT, controller interfaces.ResourceController) (deleteResourceActuator, progress.ReconcileStatus) {
+ return newActuator(ctx, orcObject, controller)
+}
diff --git a/internal/controllers/sharetype/actuator_test.go b/internal/controllers/sharetype/actuator_test.go
new file mode 100644
index 000000000..9595b8cd8
--- /dev/null
+++ b/internal/controllers/sharetype/actuator_test.go
@@ -0,0 +1,19 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package sharetype
+
+// ShareTypes are immutable after creation, so no update tests are needed
diff --git a/internal/controllers/sharetype/controller.go b/internal/controllers/sharetype/controller.go
new file mode 100644
index 000000000..4cfdfe3e6
--- /dev/null
+++ b/internal/controllers/sharetype/controller.go
@@ -0,0 +1,68 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package sharetype
+
+import (
+ "context"
+ "errors"
+
+ ctrl "sigs.k8s.io/controller-runtime"
+ "sigs.k8s.io/controller-runtime/pkg/controller"
+
+ orcv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+
+ "github.com/k-orc/openstack-resource-controller/v2/internal/controllers/generic/interfaces"
+ "github.com/k-orc/openstack-resource-controller/v2/internal/controllers/generic/reconciler"
+ "github.com/k-orc/openstack-resource-controller/v2/internal/scope"
+ "github.com/k-orc/openstack-resource-controller/v2/internal/util/credentials"
+)
+
+const controllerName = "sharetype"
+
+// +kubebuilder:rbac:groups=openstack.k-orc.cloud,resources=sharetypes,verbs=get;list;watch;create;update;patch;delete
+// +kubebuilder:rbac:groups=openstack.k-orc.cloud,resources=sharetypes/status,verbs=get;update;patch
+
+type sharetypeReconcilerConstructor struct {
+ scopeFactory scope.Factory
+}
+
+func New(scopeFactory scope.Factory) interfaces.Controller {
+ return sharetypeReconcilerConstructor{scopeFactory: scopeFactory}
+}
+
+func (sharetypeReconcilerConstructor) GetName() string {
+ return controllerName
+}
+
+// SetupWithManager sets up the controller with the Manager.
+func (c sharetypeReconcilerConstructor) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
+ log := ctrl.LoggerFrom(ctx)
+
+ builder := ctrl.NewControllerManagedBy(mgr).
+ WithOptions(options).
+ For(&orcv1alpha1.ShareType{})
+
+ if err := errors.Join(
+ credentialsDependency.AddToManager(ctx, mgr),
+ credentials.AddCredentialsWatch(log, mgr.GetClient(), builder, credentialsDependency),
+ ); err != nil {
+ return err
+ }
+
+ r := reconciler.NewController(controllerName, mgr.GetClient(), c.scopeFactory, sharetypeHelperFactory{}, sharetypeStatusWriter{})
+ return builder.Complete(&r)
+}
diff --git a/internal/controllers/sharetype/status.go b/internal/controllers/sharetype/status.go
new file mode 100644
index 000000000..57fa36953
--- /dev/null
+++ b/internal/controllers/sharetype/status.go
@@ -0,0 +1,67 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package sharetype
+
+import (
+ "github.com/go-logr/logr"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+ orcv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+ "github.com/k-orc/openstack-resource-controller/v2/internal/controllers/generic/interfaces"
+ "github.com/k-orc/openstack-resource-controller/v2/internal/controllers/generic/progress"
+ orcapplyconfigv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/pkg/clients/applyconfiguration/api/v1alpha1"
+)
+
+type sharetypeStatusWriter struct{}
+
+type objectApplyT = orcapplyconfigv1alpha1.ShareTypeApplyConfiguration
+type statusApplyT = orcapplyconfigv1alpha1.ShareTypeStatusApplyConfiguration
+
+var _ interfaces.ResourceStatusWriter[*orcv1alpha1.ShareType, *osResourceT, *objectApplyT, *statusApplyT] = sharetypeStatusWriter{}
+
+func (sharetypeStatusWriter) GetApplyConfig(name, namespace string) *objectApplyT {
+ return orcapplyconfigv1alpha1.ShareType(name, namespace)
+}
+
+func (sharetypeStatusWriter) ResourceAvailableStatus(orcObject *orcv1alpha1.ShareType, osResource *osResourceT) (metav1.ConditionStatus, progress.ReconcileStatus) {
+ if osResource == nil {
+ if orcObject.Status.ID == nil {
+ return metav1.ConditionFalse, nil
+ } else {
+ return metav1.ConditionUnknown, nil
+ }
+ }
+ return metav1.ConditionTrue, nil
+}
+
+func (sharetypeStatusWriter) ApplyResourceStatus(log logr.Logger, osResource *osResourceT, statusApply *statusApplyT) {
+ resourceStatus := orcapplyconfigv1alpha1.ShareTypeResourceStatus().
+ WithName(osResource.Name).
+ WithIsPublic(osResource.IsPublic)
+
+ if len(osResource.ExtraSpecs) > 0 {
+ extraSpecs := make(map[string]string)
+ for k, v := range osResource.ExtraSpecs {
+ if str, ok := v.(string); ok {
+ extraSpecs[k] = str
+ }
+ }
+ resourceStatus.WithExtraSpecs(extraSpecs)
+ }
+
+ statusApply.WithResource(resourceStatus)
+}
diff --git a/internal/controllers/sharetype/tests/README.md b/internal/controllers/sharetype/tests/README.md
new file mode 100644
index 000000000..61e0fa058
--- /dev/null
+++ b/internal/controllers/sharetype/tests/README.md
@@ -0,0 +1,124 @@
+# ShareType Controller E2E Tests
+
+This directory contains end-to-end tests for the ShareType controller using KUTTL.
+
+## Test Suites
+
+### 1. sharetype-create-minimal
+Tests creating a ShareType with minimal required configuration.
+
+**What it tests:**
+- Creating ShareType with only `driverHandlesShareServers: true`
+- Default `isPublic: true` behavior
+- Correct extra spec propagation to status
+- Resource becomes Available
+- Deletion when credentials are removed
+
+**Key validations:**
+- Status has ID assigned
+- Name matches expected value
+- `isPublic` defaults to true
+- `driver_handles_share_servers` extra spec is set to "True"
+
+---
+
+### 2. sharetype-create-full
+Tests creating a ShareType with all available configuration options.
+
+**What it tests:**
+- Custom name override
+- Setting `isPublic: false` (private share type)
+- Setting `driverHandlesShareServers: false`
+- Setting `snapshotSupport: true`
+- All fields correctly reflected in status
+
+**Key validations:**
+- Name override works correctly
+- `isPublic` is false
+- `driver_handles_share_servers` extra spec is "False"
+- `snapshot_support` extra spec is "True"
+- Resource becomes Available
+
+---
+
+### 3. sharetype-import
+Tests importing an existing ShareType using filter criteria.
+
+**What it tests:**
+- Unmanaged ShareType with import filter
+- Filter matching by name and isPublic
+- Correct filtering (doesn't match wrong resources)
+- Import waits until matching resource exists
+
+**Test flow:**
+1. Create unmanaged ShareType with filter (name + `isPublic: false`)
+2. Verify it waits for resource (Progressing=True)
+3. Create "trap" ShareType with same name but `isPublic: true`
+4. Verify import doesn't match the trap (still waiting)
+5. Create actual ShareType with matching criteria
+6. Verify import matches the correct resource
+7. Verify imported resource has all expected fields
+
+**Key validations:**
+- Import waits when no match found
+- Import doesn't match resources with different isPublic
+- Import correctly identifies matching resource
+- Imported resource ID matches created resource ID
+- Extra specs are correctly imported
+
+---
+
+### 4. sharetype-import-error
+Tests error handling when import filter doesn't match any resource.
+
+**What it tests:**
+- Graceful handling of non-matching import filter
+- Continuous retry behavior
+
+**Key validations:**
+- Resource enters and stays in Progressing state
+- No ID is assigned (resource not found)
+- Appropriate condition messages
+
+---
+
+## Running the Tests
+
+### Prerequisites
+- Running OpenStack Manila service
+- Admin credentials configured in `$E2E_KUTTL_OSCLOUDS`
+- ORC controller running
+
+### Run all ShareType tests
+```bash
+make test-e2e ARGS="--test sharetype"
+```
+
+### Run a specific test
+```bash
+kubectl kuttl test --config kuttl-test.yaml --test sharetype-create-minimal
+```
+
+## Test Design Notes
+
+### ShareType Immutability
+ShareTypes are **immutable** after creation per Manila API design. Therefore:
+- No update tests are included
+- All fields in `ShareTypeResourceSpec` have immutability validation
+- Changes to spec require delete + recreate
+
+### No Dependencies
+ShareTypes don't depend on other ORC resources, so:
+- No dependency tests are included
+- Tests only need admin credentials (no other resources to set up)
+
+### Required Fields
+- `driverHandlesShareServers` is required per Manila specification
+- This field determines if the storage backend manages share servers
+
+### Extra Specs
+Extra specs are stored as `map[string]interface{}` in OpenStack but are converted to `map[string]string` in the status for consistency.
+
+Boolean values in extra specs are represented as strings:
+- `true` → `"True"`
+- `false` → `"False"`
diff --git a/internal/controllers/sharetype/tests/sharetype-create-full/00-assert.yaml b/internal/controllers/sharetype/tests/sharetype-create-full/00-assert.yaml
new file mode 100644
index 000000000..3bc1912b1
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-create-full/00-assert.yaml
@@ -0,0 +1,31 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: ShareType
+metadata:
+ name: sharetype-create-full
+status:
+ resource:
+ name: sharetype-create-full-override
+ isPublic: false
+ conditions:
+ - type: Available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ status: "False"
+ reason: Success
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+resourceRefs:
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: ShareType
+ name: sharetype-create-full
+ ref: sharetype
+assertAll:
+ - celExpr: "sharetype.status.id != ''"
+ - celExpr: "sharetype.status.resource.name == 'sharetype-create-full-override'"
+ - celExpr: "sharetype.status.resource.isPublic == false"
+ - celExpr: "has(sharetype.status.resource.extraSpecs)"
+ - celExpr: "sharetype.status.resource.extraSpecs['driver_handles_share_servers'] == 'False'"
+ - celExpr: "sharetype.status.resource.extraSpecs['snapshot_support'] == 'True'"
diff --git a/internal/controllers/sharetype/tests/sharetype-create-full/00-create-resource.yaml b/internal/controllers/sharetype/tests/sharetype-create-full/00-create-resource.yaml
new file mode 100644
index 000000000..435fee3f3
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-create-full/00-create-resource.yaml
@@ -0,0 +1,15 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: ShareType
+metadata:
+ name: sharetype-create-full
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack-admin
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ name: sharetype-create-full-override
+ isPublic: false
+ driverHandlesShareServers: false
+ snapshotSupport: true
diff --git a/internal/controllers/sharetype/tests/sharetype-create-full/00-secret.yaml b/internal/controllers/sharetype/tests/sharetype-create-full/00-secret.yaml
new file mode 100644
index 000000000..045711ee7
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-create-full/00-secret.yaml
@@ -0,0 +1,6 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestStep
+commands:
+ - command: kubectl create secret generic openstack-clouds --from-file=clouds.yaml=${E2E_KUTTL_OSCLOUDS} ${E2E_KUTTL_CACERT_OPT}
+ namespaced: true
diff --git a/internal/controllers/sharetype/tests/sharetype-create-full/01-assert.yaml b/internal/controllers/sharetype/tests/sharetype-create-full/01-assert.yaml
new file mode 100644
index 000000000..242c5ef40
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-create-full/01-assert.yaml
@@ -0,0 +1,7 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+assertAbsent:
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: ShareType
+ name: sharetype-create-full
diff --git a/internal/controllers/sharetype/tests/sharetype-create-full/01-delete-secret.yaml b/internal/controllers/sharetype/tests/sharetype-create-full/01-delete-secret.yaml
new file mode 100644
index 000000000..509e7a470
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-create-full/01-delete-secret.yaml
@@ -0,0 +1,5 @@
+---
+apiVersion: v1
+kind: Secret
+metadata:
+ name: openstack-clouds
diff --git a/internal/controllers/sharetype/tests/sharetype-create-full/README.md b/internal/controllers/sharetype/tests/sharetype-create-full/README.md
new file mode 100644
index 000000000..d5c5f9e9e
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-create-full/README.md
@@ -0,0 +1,14 @@
+# sharetype-create-full
+
+Creates a ShareType with all available configuration options:
+- Custom name override
+- isPublic set to false (private share type)
+- driverHandlesShareServers set to false
+- snapshotSupport set to true
+
+Validates that:
+- The ShareType is created with the overridden name
+- isPublic is false
+- All extra specs are correctly set
+- Resource becomes Available
+- Resource is deleted when credentials are removed
diff --git a/internal/controllers/sharetype/tests/sharetype-create-minimal/00-assert.yaml b/internal/controllers/sharetype/tests/sharetype-create-minimal/00-assert.yaml
new file mode 100644
index 000000000..a1fd8dd4b
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-create-minimal/00-assert.yaml
@@ -0,0 +1,30 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: ShareType
+metadata:
+ name: sharetype-create-minimal
+status:
+ resource:
+ name: sharetype-create-minimal
+ isPublic: true
+ conditions:
+ - type: Available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ status: "False"
+ reason: Success
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+resourceRefs:
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: ShareType
+ name: sharetype-create-minimal
+ ref: sharetype
+assertAll:
+ - celExpr: "sharetype.status.id != ''"
+ - celExpr: "sharetype.status.resource.name == 'sharetype-create-minimal'"
+ - celExpr: "sharetype.status.resource.isPublic == true"
+ - celExpr: "has(sharetype.status.resource.extraSpecs)"
+ - celExpr: "sharetype.status.resource.extraSpecs['driver_handles_share_servers'] == 'True'"
diff --git a/internal/controllers/sharetype/tests/sharetype-create-minimal/00-create-resource.yaml b/internal/controllers/sharetype/tests/sharetype-create-minimal/00-create-resource.yaml
new file mode 100644
index 000000000..a63c4d456
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-create-minimal/00-create-resource.yaml
@@ -0,0 +1,12 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: ShareType
+metadata:
+ name: sharetype-create-minimal
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack-admin
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ driverHandlesShareServers: true
diff --git a/internal/controllers/sharetype/tests/sharetype-create-minimal/00-secret.yaml b/internal/controllers/sharetype/tests/sharetype-create-minimal/00-secret.yaml
new file mode 100644
index 000000000..045711ee7
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-create-minimal/00-secret.yaml
@@ -0,0 +1,6 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestStep
+commands:
+ - command: kubectl create secret generic openstack-clouds --from-file=clouds.yaml=${E2E_KUTTL_OSCLOUDS} ${E2E_KUTTL_CACERT_OPT}
+ namespaced: true
diff --git a/internal/controllers/sharetype/tests/sharetype-create-minimal/01-assert.yaml b/internal/controllers/sharetype/tests/sharetype-create-minimal/01-assert.yaml
new file mode 100644
index 000000000..332d81ba3
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-create-minimal/01-assert.yaml
@@ -0,0 +1,7 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+assertAbsent:
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: ShareType
+ name: sharetype-create-minimal
diff --git a/internal/controllers/sharetype/tests/sharetype-create-minimal/01-delete-secret.yaml b/internal/controllers/sharetype/tests/sharetype-create-minimal/01-delete-secret.yaml
new file mode 100644
index 000000000..509e7a470
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-create-minimal/01-delete-secret.yaml
@@ -0,0 +1,5 @@
+---
+apiVersion: v1
+kind: Secret
+metadata:
+ name: openstack-clouds
diff --git a/internal/controllers/sharetype/tests/sharetype-create-minimal/README.md b/internal/controllers/sharetype/tests/sharetype-create-minimal/README.md
new file mode 100644
index 000000000..828e55440
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-create-minimal/README.md
@@ -0,0 +1,10 @@
+# sharetype-create-minimal
+
+Creates a ShareType with the minimal required configuration (only driverHandlesShareServers set to true).
+
+Validates that:
+- The ShareType is created with the correct name
+- Default isPublic is true
+- The required driver_handles_share_servers extra spec is set
+- Resource becomes Available
+- Resource is deleted when credentials are removed
diff --git a/internal/controllers/sharetype/tests/sharetype-import-error/00-assert.yaml b/internal/controllers/sharetype/tests/sharetype-import-error/00-assert.yaml
new file mode 100644
index 000000000..72e07e29a
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-import-error/00-assert.yaml
@@ -0,0 +1,24 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: ShareType
+metadata:
+ name: sharetype-import-error
+status:
+ conditions:
+ - type: Available
+ status: "False"
+ reason: Progressing
+ - type: Progressing
+ status: "True"
+ reason: Progressing
+ message: Waiting for OpenStack resource to be created externally
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+resourceRefs:
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: ShareType
+ name: sharetype-import-error
+ ref: sharetype
+assertAll:
+ - celExpr: "!has(sharetype.status.id)"
diff --git a/internal/controllers/sharetype/tests/sharetype-import-error/00-import-resource.yaml b/internal/controllers/sharetype/tests/sharetype-import-error/00-import-resource.yaml
new file mode 100644
index 000000000..978f7e491
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-import-error/00-import-resource.yaml
@@ -0,0 +1,13 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: ShareType
+metadata:
+ name: sharetype-import-error
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack-admin
+ secretName: openstack-clouds
+ managementPolicy: unmanaged
+ import:
+ filter:
+ name: sharetype-import-does-not-exist
diff --git a/internal/controllers/sharetype/tests/sharetype-import-error/00-secret.yaml b/internal/controllers/sharetype/tests/sharetype-import-error/00-secret.yaml
new file mode 100644
index 000000000..045711ee7
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-import-error/00-secret.yaml
@@ -0,0 +1,6 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestStep
+commands:
+ - command: kubectl create secret generic openstack-clouds --from-file=clouds.yaml=${E2E_KUTTL_OSCLOUDS} ${E2E_KUTTL_CACERT_OPT}
+ namespaced: true
diff --git a/internal/controllers/sharetype/tests/sharetype-import-error/README.md b/internal/controllers/sharetype/tests/sharetype-import-error/README.md
new file mode 100644
index 000000000..c8ac7bd36
--- /dev/null
+++ b/internal/controllers/sharetype/tests/sharetype-import-error/README.md
@@ -0,0 +1,10 @@
+# sharetype-import-error
+
+Tests error handling when import filter doesn't match any existing resource.
+
+The test:
+1. Creates an unmanaged ShareType with import filter for non-existent name
+2. Verifies it enters and stays in Progressing state waiting for the resource
+3. Verifies no ID is assigned (resource not found)
+
+This ensures graceful handling when import criteria don't match anything.
diff --git a/internal/controllers/sharetype/zz_generated.adapter.go b/internal/controllers/sharetype/zz_generated.adapter.go
new file mode 100644
index 000000000..97f2175ca
--- /dev/null
+++ b/internal/controllers/sharetype/zz_generated.adapter.go
@@ -0,0 +1,88 @@
+// Code generated by resource-generator. DO NOT EDIT.
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package sharetype
+
+import (
+ orcv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+ "github.com/k-orc/openstack-resource-controller/v2/internal/controllers/generic/interfaces"
+)
+
+// Fundamental types
+type (
+ orcObjectT = orcv1alpha1.ShareType
+ orcObjectListT = orcv1alpha1.ShareTypeList
+ resourceSpecT = orcv1alpha1.ShareTypeResourceSpec
+ filterT = orcv1alpha1.ShareTypeFilter
+)
+
+// Derived types
+type (
+ orcObjectPT = *orcObjectT
+ adapterI = interfaces.APIObjectAdapter[orcObjectPT, resourceSpecT, filterT]
+ adapterT = sharetypeAdapter
+)
+
+type sharetypeAdapter struct {
+ *orcv1alpha1.ShareType
+}
+
+var _ adapterI = &adapterT{}
+
+func (f adapterT) GetObject() orcObjectPT {
+ return f.ShareType
+}
+
+func (f adapterT) GetManagementPolicy() orcv1alpha1.ManagementPolicy {
+ return f.Spec.ManagementPolicy
+}
+
+func (f adapterT) GetManagedOptions() *orcv1alpha1.ManagedOptions {
+ return f.Spec.ManagedOptions
+}
+
+func (f adapterT) GetStatusID() *string {
+ return f.Status.ID
+}
+
+func (f adapterT) GetResourceSpec() *resourceSpecT {
+ return f.Spec.Resource
+}
+
+func (f adapterT) GetImportID() *string {
+ if f.Spec.Import == nil {
+ return nil
+ }
+ return f.Spec.Import.ID
+}
+
+func (f adapterT) GetImportFilter() *filterT {
+ if f.Spec.Import == nil {
+ return nil
+ }
+ return f.Spec.Import.Filter
+}
+
+// getResourceName returns the name of the OpenStack resource we should use.
+// This method is not implemented as part of APIObjectAdapter as it is intended
+// to be used by resource actuators, which don't use the adapter.
+func getResourceName(orcObject orcObjectPT) string {
+ if orcObject.Spec.Resource.Name != nil {
+ return string(*orcObject.Spec.Resource.Name)
+ }
+ return orcObject.Name
+}
diff --git a/internal/controllers/sharetype/zz_generated.controller.go b/internal/controllers/sharetype/zz_generated.controller.go
new file mode 100644
index 000000000..3accc9770
--- /dev/null
+++ b/internal/controllers/sharetype/zz_generated.controller.go
@@ -0,0 +1,45 @@
+// Code generated by resource-generator. DO NOT EDIT.
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package sharetype
+
+import (
+ corev1 "k8s.io/api/core/v1"
+
+ "github.com/k-orc/openstack-resource-controller/v2/internal/util/dependency"
+ orcstrings "github.com/k-orc/openstack-resource-controller/v2/internal/util/strings"
+)
+
+var (
+ // NOTE: controllerName must be defined in any controller using this template
+
+ // finalizer is the string this controller adds to an object's Finalizers
+ finalizer = orcstrings.GetFinalizerName(controllerName)
+
+ // externalObjectFieldOwner is the field owner we use when using
+ // server-side-apply on objects we don't control
+ externalObjectFieldOwner = orcstrings.GetSSAFieldOwner(controllerName)
+
+ credentialsDependency = dependency.NewDeletionGuardDependency[*orcObjectListT, *corev1.Secret](
+ "spec.cloudCredentialsRef.secretName",
+ func(obj orcObjectPT) []string {
+ return []string{obj.Spec.CloudCredentialsRef.SecretName}
+ },
+ finalizer, externalObjectFieldOwner,
+ dependency.OverrideDependencyName("credentials"),
+ )
+)
diff --git a/internal/osclients/mock/doc.go b/internal/osclients/mock/doc.go
index 5ee7aa5da..48ebfa845 100644
--- a/internal/osclients/mock/doc.go
+++ b/internal/osclients/mock/doc.go
@@ -62,6 +62,9 @@ import (
//go:generate mockgen -package mock -destination=sharenetwork.go -source=../sharenetwork.go github.com/k-orc/openstack-resource-controller/internal/osclients/mock ShareNetworkClient
//go:generate /usr/bin/env bash -c "cat ../../../hack/boilerplate.go.txt sharenetwork.go > _sharenetwork.go && mv _sharenetwork.go sharenetwork.go"
+//go:generate mockgen -package mock -destination=sharetype.go -source=../sharetype.go github.com/k-orc/openstack-resource-controller/internal/osclients/mock ShareTypeClient
+//go:generate /usr/bin/env bash -c "cat ../../../hack/boilerplate.go.txt sharetype.go > _sharetype.go && mv _sharetype.go sharetype.go"
+
//go:generate mockgen -package mock -destination=user.go -source=../user.go github.com/k-orc/openstack-resource-controller/internal/osclients/mock UserClient
//go:generate /usr/bin/env bash -c "cat ../../../hack/boilerplate.go.txt user.go > _user.go && mv _user.go user.go"
diff --git a/internal/osclients/mock/sharetype.go b/internal/osclients/mock/sharetype.go
new file mode 100644
index 000000000..ef0706ee3
--- /dev/null
+++ b/internal/osclients/mock/sharetype.go
@@ -0,0 +1,116 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+// Code generated by MockGen. DO NOT EDIT.
+// Source: ../sharetype.go
+//
+// Generated by this command:
+//
+// mockgen -package mock -destination=sharetype.go -source=../sharetype.go github.com/k-orc/openstack-resource-controller/internal/osclients/mock ShareTypeClient
+//
+
+// Package mock is a generated GoMock package.
+package mock
+
+import (
+ context "context"
+ iter "iter"
+ reflect "reflect"
+
+ sharetypes "github.com/gophercloud/gophercloud/v2/openstack/sharedfilesystems/v2/sharetypes"
+ gomock "go.uber.org/mock/gomock"
+)
+
+// MockShareTypeClient is a mock of ShareTypeClient interface.
+type MockShareTypeClient struct {
+ ctrl *gomock.Controller
+ recorder *MockShareTypeClientMockRecorder
+ isgomock struct{}
+}
+
+// MockShareTypeClientMockRecorder is the mock recorder for MockShareTypeClient.
+type MockShareTypeClientMockRecorder struct {
+ mock *MockShareTypeClient
+}
+
+// NewMockShareTypeClient creates a new mock instance.
+func NewMockShareTypeClient(ctrl *gomock.Controller) *MockShareTypeClient {
+ mock := &MockShareTypeClient{ctrl: ctrl}
+ mock.recorder = &MockShareTypeClientMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockShareTypeClient) EXPECT() *MockShareTypeClientMockRecorder {
+ return m.recorder
+}
+
+// CreateShareType mocks base method.
+func (m *MockShareTypeClient) CreateShareType(ctx context.Context, opts sharetypes.CreateOptsBuilder) (*sharetypes.ShareType, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "CreateShareType", ctx, opts)
+ ret0, _ := ret[0].(*sharetypes.ShareType)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// CreateShareType indicates an expected call of CreateShareType.
+func (mr *MockShareTypeClientMockRecorder) CreateShareType(ctx, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateShareType", reflect.TypeOf((*MockShareTypeClient)(nil).CreateShareType), ctx, opts)
+}
+
+// DeleteShareType mocks base method.
+func (m *MockShareTypeClient) DeleteShareType(ctx context.Context, resourceID string) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "DeleteShareType", ctx, resourceID)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// DeleteShareType indicates an expected call of DeleteShareType.
+func (mr *MockShareTypeClientMockRecorder) DeleteShareType(ctx, resourceID any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteShareType", reflect.TypeOf((*MockShareTypeClient)(nil).DeleteShareType), ctx, resourceID)
+}
+
+// GetExtraSpecs mocks base method.
+func (m *MockShareTypeClient) GetExtraSpecs(ctx context.Context, resourceID string) (sharetypes.ExtraSpecs, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetExtraSpecs", ctx, resourceID)
+ ret0, _ := ret[0].(sharetypes.ExtraSpecs)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GetExtraSpecs indicates an expected call of GetExtraSpecs.
+func (mr *MockShareTypeClientMockRecorder) GetExtraSpecs(ctx, resourceID any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExtraSpecs", reflect.TypeOf((*MockShareTypeClient)(nil).GetExtraSpecs), ctx, resourceID)
+}
+
+// ListShareTypes mocks base method.
+func (m *MockShareTypeClient) ListShareTypes(ctx context.Context, listOpts sharetypes.ListOptsBuilder) iter.Seq2[*sharetypes.ShareType, error] {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "ListShareTypes", ctx, listOpts)
+ ret0, _ := ret[0].(iter.Seq2[*sharetypes.ShareType, error])
+ return ret0
+}
+
+// ListShareTypes indicates an expected call of ListShareTypes.
+func (mr *MockShareTypeClientMockRecorder) ListShareTypes(ctx, listOpts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListShareTypes", reflect.TypeOf((*MockShareTypeClient)(nil).ListShareTypes), ctx, listOpts)
+}
diff --git a/internal/osclients/sharetype.go b/internal/osclients/sharetype.go
new file mode 100644
index 000000000..1d0bb4a61
--- /dev/null
+++ b/internal/osclients/sharetype.go
@@ -0,0 +1,95 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package osclients
+
+import (
+ "context"
+ "fmt"
+ "iter"
+
+ "github.com/gophercloud/gophercloud/v2"
+ "github.com/gophercloud/gophercloud/v2/openstack"
+ "github.com/gophercloud/gophercloud/v2/openstack/sharedfilesystems/v2/sharetypes"
+ "github.com/gophercloud/utils/v2/openstack/clientconfig"
+)
+
+type ShareTypeClient interface {
+ ListShareTypes(ctx context.Context, listOpts sharetypes.ListOptsBuilder) iter.Seq2[*sharetypes.ShareType, error]
+ CreateShareType(ctx context.Context, opts sharetypes.CreateOptsBuilder) (*sharetypes.ShareType, error)
+ DeleteShareType(ctx context.Context, resourceID string) error
+ GetExtraSpecs(ctx context.Context, resourceID string) (sharetypes.ExtraSpecs, error)
+}
+
+type sharetypeClient struct{ client *gophercloud.ServiceClient }
+
+// NewShareTypeClient returns a new OpenStack client.
+func NewShareTypeClient(providerClient *gophercloud.ProviderClient, providerClientOpts *clientconfig.ClientOpts) (ShareTypeClient, error) {
+ client, err := openstack.NewSharedFileSystemV2(providerClient, gophercloud.EndpointOpts{
+ Region: providerClientOpts.RegionName,
+ Availability: clientconfig.GetEndpointType(providerClientOpts.EndpointType),
+ })
+
+ if err != nil {
+ return nil, fmt.Errorf("failed to create sharetype service client: %v", err)
+ }
+
+ return &sharetypeClient{client}, nil
+}
+
+func (c sharetypeClient) ListShareTypes(ctx context.Context, listOpts sharetypes.ListOptsBuilder) iter.Seq2[*sharetypes.ShareType, error] {
+ pager := sharetypes.List(c.client, listOpts)
+ return func(yield func(*sharetypes.ShareType, error) bool) {
+ _ = pager.EachPage(ctx, yieldPage(sharetypes.ExtractShareTypes, yield))
+ }
+}
+
+func (c sharetypeClient) CreateShareType(ctx context.Context, opts sharetypes.CreateOptsBuilder) (*sharetypes.ShareType, error) {
+ return sharetypes.Create(ctx, c.client, opts).Extract()
+}
+
+func (c sharetypeClient) DeleteShareType(ctx context.Context, resourceID string) error {
+ return sharetypes.Delete(ctx, c.client, resourceID).ExtractErr()
+}
+
+func (c sharetypeClient) GetExtraSpecs(ctx context.Context, resourceID string) (sharetypes.ExtraSpecs, error) {
+ return sharetypes.GetExtraSpecs(ctx, c.client, resourceID).Extract()
+}
+
+type sharetypeErrorClient struct{ error }
+
+// NewShareTypeErrorClient returns a ShareTypeClient in which every method returns the given error.
+func NewShareTypeErrorClient(e error) ShareTypeClient {
+ return sharetypeErrorClient{e}
+}
+
+func (e sharetypeErrorClient) ListShareTypes(_ context.Context, _ sharetypes.ListOptsBuilder) iter.Seq2[*sharetypes.ShareType, error] {
+ return func(yield func(*sharetypes.ShareType, error) bool) {
+ yield(nil, e.error)
+ }
+}
+
+func (e sharetypeErrorClient) CreateShareType(_ context.Context, _ sharetypes.CreateOptsBuilder) (*sharetypes.ShareType, error) {
+ return nil, e.error
+}
+
+func (e sharetypeErrorClient) DeleteShareType(_ context.Context, _ string) error {
+ return e.error
+}
+
+func (e sharetypeErrorClient) GetExtraSpecs(_ context.Context, _ string) (sharetypes.ExtraSpecs, error) {
+ return nil, e.error
+}
diff --git a/internal/scope/mock.go b/internal/scope/mock.go
index 8ea474b64..584034c4e 100644
--- a/internal/scope/mock.go
+++ b/internal/scope/mock.go
@@ -50,6 +50,7 @@ type MockScopeFactory struct {
VolumeClient *mock.MockVolumeClient
VolumeTypeClient *mock.MockVolumeTypeClient
ShareNetworkClient *mock.MockShareNetworkClient
+ ShareTypeClient *mock.MockShareTypeClient
clientScopeCreateError error
}
@@ -69,6 +70,7 @@ func NewMockScopeFactory(mockCtrl *gomock.Controller) *MockScopeFactory {
serviceClient := mock.NewMockServiceClient(mockCtrl)
userClient := mock.NewMockUserClient(mockCtrl)
sharenetworkClient := mock.NewMockShareNetworkClient(mockCtrl)
+ sharetypeClient := mock.NewMockShareTypeClient(mockCtrl)
volumeClient := mock.NewMockVolumeClient(mockCtrl)
volumetypeClient := mock.NewMockVolumeTypeClient(mockCtrl)
@@ -86,6 +88,7 @@ func NewMockScopeFactory(mockCtrl *gomock.Controller) *MockScopeFactory {
RoleClient: roleClient,
ServiceClient: serviceClient,
ShareNetworkClient: sharenetworkClient,
+ ShareTypeClient: sharetypeClient,
UserClient: userClient,
VolumeClient: volumeClient,
VolumeTypeClient: volumetypeClient,
@@ -147,6 +150,10 @@ func (f *MockScopeFactory) NewShareNetworkClient() (osclients.ShareNetworkClient
return f.ShareNetworkClient, nil
}
+func (f *MockScopeFactory) NewShareTypeClient() (osclients.ShareTypeClient, error) {
+ return f.ShareTypeClient, nil
+}
+
func (f *MockScopeFactory) NewKeyPairClient() (osclients.KeyPairClient, error) {
return f.KeyPairClient, nil
}
diff --git a/internal/scope/provider.go b/internal/scope/provider.go
index 1606e18a1..8f3819304 100644
--- a/internal/scope/provider.go
+++ b/internal/scope/provider.go
@@ -189,6 +189,10 @@ func (s *providerScope) NewShareNetworkClient() (clients.ShareNetworkClient, err
return clients.NewShareNetworkClient(s.providerClient, s.providerClientOpts)
}
+func (s *providerScope) NewShareTypeClient() (clients.ShareTypeClient, error) {
+ return clients.NewShareTypeClient(s.providerClient, s.providerClientOpts)
+}
+
func (s *providerScope) NewKeyPairClient() (clients.KeyPairClient, error) {
return clients.NewKeyPairClient(s.providerClient, s.providerClientOpts)
}
diff --git a/internal/scope/scope.go b/internal/scope/scope.go
index 0b02b79bd..faf509ca0 100644
--- a/internal/scope/scope.go
+++ b/internal/scope/scope.go
@@ -61,6 +61,7 @@ type Scope interface {
NewRoleClient() (osclients.RoleClient, error)
NewServiceClient() (osclients.ServiceClient, error)
NewShareNetworkClient() (osclients.ShareNetworkClient, error)
+ NewShareTypeClient() (osclients.ShareTypeClient, error)
NewUserClient() (osclients.UserClient, error)
NewVolumeClient() (osclients.VolumeClient, error)
NewVolumeTypeClient() (osclients.VolumeTypeClient, error)
diff --git a/kuttl-test.yaml b/kuttl-test.yaml
index 71fc135ed..d205d68f4 100644
--- a/kuttl-test.yaml
+++ b/kuttl-test.yaml
@@ -22,6 +22,7 @@ testDirs:
- ./internal/controllers/servergroup/tests/
- ./internal/controllers/service/tests/
- ./internal/controllers/sharenetwork/tests/
+- ./internal/controllers/sharetype/tests/
- ./internal/controllers/subnet/tests/
- ./internal/controllers/trunk/tests/
- ./internal/controllers/user/tests/
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/sharetype.go b/pkg/clients/applyconfiguration/api/v1alpha1/sharetype.go
new file mode 100644
index 000000000..441338147
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/sharetype.go
@@ -0,0 +1,281 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by applyconfiguration-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ apiv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+ internal "github.com/k-orc/openstack-resource-controller/v2/pkg/clients/applyconfiguration/internal"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ types "k8s.io/apimachinery/pkg/types"
+ managedfields "k8s.io/apimachinery/pkg/util/managedfields"
+ v1 "k8s.io/client-go/applyconfigurations/meta/v1"
+)
+
+// ShareTypeApplyConfiguration represents a declarative configuration of the ShareType type for use
+// with apply.
+type ShareTypeApplyConfiguration struct {
+ v1.TypeMetaApplyConfiguration `json:",inline"`
+ *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
+ Spec *ShareTypeSpecApplyConfiguration `json:"spec,omitempty"`
+ Status *ShareTypeStatusApplyConfiguration `json:"status,omitempty"`
+}
+
+// ShareType constructs a declarative configuration of the ShareType type for use with
+// apply.
+func ShareType(name, namespace string) *ShareTypeApplyConfiguration {
+ b := &ShareTypeApplyConfiguration{}
+ b.WithName(name)
+ b.WithNamespace(namespace)
+ b.WithKind("ShareType")
+ b.WithAPIVersion("openstack.k-orc.cloud/v1alpha1")
+ return b
+}
+
+// ExtractShareType extracts the applied configuration owned by fieldManager from
+// shareType. If no managedFields are found in shareType for fieldManager, a
+// ShareTypeApplyConfiguration is returned with only the Name, Namespace (if applicable),
+// APIVersion and Kind populated. It is possible that no managed fields were found for because other
+// field managers have taken ownership of all the fields previously owned by fieldManager, or because
+// the fieldManager never owned fields any fields.
+// shareType must be a unmodified ShareType API object that was retrieved from the Kubernetes API.
+// ExtractShareType provides a way to perform a extract/modify-in-place/apply workflow.
+// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
+// applied if another fieldManager has updated or force applied any of the previously applied fields.
+// Experimental!
+func ExtractShareType(shareType *apiv1alpha1.ShareType, fieldManager string) (*ShareTypeApplyConfiguration, error) {
+ return extractShareType(shareType, fieldManager, "")
+}
+
+// ExtractShareTypeStatus is the same as ExtractShareType except
+// that it extracts the status subresource applied configuration.
+// Experimental!
+func ExtractShareTypeStatus(shareType *apiv1alpha1.ShareType, fieldManager string) (*ShareTypeApplyConfiguration, error) {
+ return extractShareType(shareType, fieldManager, "status")
+}
+
+func extractShareType(shareType *apiv1alpha1.ShareType, fieldManager string, subresource string) (*ShareTypeApplyConfiguration, error) {
+ b := &ShareTypeApplyConfiguration{}
+ err := managedfields.ExtractInto(shareType, internal.Parser().Type("com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareType"), fieldManager, b, subresource)
+ if err != nil {
+ return nil, err
+ }
+ b.WithName(shareType.Name)
+ b.WithNamespace(shareType.Namespace)
+
+ b.WithKind("ShareType")
+ b.WithAPIVersion("openstack.k-orc.cloud/v1alpha1")
+ return b, nil
+}
+func (b ShareTypeApplyConfiguration) IsApplyConfiguration() {}
+
+// WithKind sets the Kind field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Kind field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithKind(value string) *ShareTypeApplyConfiguration {
+ b.TypeMetaApplyConfiguration.Kind = &value
+ return b
+}
+
+// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the APIVersion field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithAPIVersion(value string) *ShareTypeApplyConfiguration {
+ b.TypeMetaApplyConfiguration.APIVersion = &value
+ return b
+}
+
+// WithName sets the Name field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Name field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithName(value string) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.ObjectMetaApplyConfiguration.Name = &value
+ return b
+}
+
+// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the GenerateName field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithGenerateName(value string) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.ObjectMetaApplyConfiguration.GenerateName = &value
+ return b
+}
+
+// WithNamespace sets the Namespace field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Namespace field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithNamespace(value string) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.ObjectMetaApplyConfiguration.Namespace = &value
+ return b
+}
+
+// WithUID sets the UID field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the UID field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithUID(value types.UID) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.ObjectMetaApplyConfiguration.UID = &value
+ return b
+}
+
+// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the ResourceVersion field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithResourceVersion(value string) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.ObjectMetaApplyConfiguration.ResourceVersion = &value
+ return b
+}
+
+// WithGeneration sets the Generation field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Generation field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithGeneration(value int64) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.ObjectMetaApplyConfiguration.Generation = &value
+ return b
+}
+
+// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the CreationTimestamp field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
+ return b
+}
+
+// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
+ return b
+}
+
+// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
+ return b
+}
+
+// WithLabels puts the entries into the Labels field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, the entries provided by each call will be put on the Labels field,
+// overwriting an existing map entries in Labels field with the same key.
+func (b *ShareTypeApplyConfiguration) WithLabels(entries map[string]string) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
+ b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
+ }
+ for k, v := range entries {
+ b.ObjectMetaApplyConfiguration.Labels[k] = v
+ }
+ return b
+}
+
+// WithAnnotations puts the entries into the Annotations field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, the entries provided by each call will be put on the Annotations field,
+// overwriting an existing map entries in Annotations field with the same key.
+func (b *ShareTypeApplyConfiguration) WithAnnotations(entries map[string]string) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
+ b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
+ }
+ for k, v := range entries {
+ b.ObjectMetaApplyConfiguration.Annotations[k] = v
+ }
+ return b
+}
+
+// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
+func (b *ShareTypeApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ for i := range values {
+ if values[i] == nil {
+ panic("nil value passed to WithOwnerReferences")
+ }
+ b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
+ }
+ return b
+}
+
+// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, values provided by each call will be appended to the Finalizers field.
+func (b *ShareTypeApplyConfiguration) WithFinalizers(values ...string) *ShareTypeApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ for i := range values {
+ b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
+ }
+ return b
+}
+
+func (b *ShareTypeApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
+ if b.ObjectMetaApplyConfiguration == nil {
+ b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
+ }
+}
+
+// WithSpec sets the Spec field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Spec field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithSpec(value *ShareTypeSpecApplyConfiguration) *ShareTypeApplyConfiguration {
+ b.Spec = value
+ return b
+}
+
+// WithStatus sets the Status field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Status field is set to the value of the last call.
+func (b *ShareTypeApplyConfiguration) WithStatus(value *ShareTypeStatusApplyConfiguration) *ShareTypeApplyConfiguration {
+ b.Status = value
+ return b
+}
+
+// GetKind retrieves the value of the Kind field in the declarative configuration.
+func (b *ShareTypeApplyConfiguration) GetKind() *string {
+ return b.TypeMetaApplyConfiguration.Kind
+}
+
+// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
+func (b *ShareTypeApplyConfiguration) GetAPIVersion() *string {
+ return b.TypeMetaApplyConfiguration.APIVersion
+}
+
+// GetName retrieves the value of the Name field in the declarative configuration.
+func (b *ShareTypeApplyConfiguration) GetName() *string {
+ b.ensureObjectMetaApplyConfigurationExists()
+ return b.ObjectMetaApplyConfiguration.Name
+}
+
+// GetNamespace retrieves the value of the Namespace field in the declarative configuration.
+func (b *ShareTypeApplyConfiguration) GetNamespace() *string {
+ b.ensureObjectMetaApplyConfigurationExists()
+ return b.ObjectMetaApplyConfiguration.Namespace
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/sharetypefilter.go b/pkg/clients/applyconfiguration/api/v1alpha1/sharetypefilter.go
new file mode 100644
index 000000000..e28e8373a
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/sharetypefilter.go
@@ -0,0 +1,52 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by applyconfiguration-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ apiv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+)
+
+// ShareTypeFilterApplyConfiguration represents a declarative configuration of the ShareTypeFilter type for use
+// with apply.
+type ShareTypeFilterApplyConfiguration struct {
+ Name *apiv1alpha1.OpenStackName `json:"name,omitempty"`
+ IsPublic *bool `json:"isPublic,omitempty"`
+}
+
+// ShareTypeFilterApplyConfiguration constructs a declarative configuration of the ShareTypeFilter type for use with
+// apply.
+func ShareTypeFilter() *ShareTypeFilterApplyConfiguration {
+ return &ShareTypeFilterApplyConfiguration{}
+}
+
+// WithName sets the Name field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Name field is set to the value of the last call.
+func (b *ShareTypeFilterApplyConfiguration) WithName(value apiv1alpha1.OpenStackName) *ShareTypeFilterApplyConfiguration {
+ b.Name = &value
+ return b
+}
+
+// WithIsPublic sets the IsPublic field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the IsPublic field is set to the value of the last call.
+func (b *ShareTypeFilterApplyConfiguration) WithIsPublic(value bool) *ShareTypeFilterApplyConfiguration {
+ b.IsPublic = &value
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/sharetypeimport.go b/pkg/clients/applyconfiguration/api/v1alpha1/sharetypeimport.go
new file mode 100644
index 000000000..534211df5
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/sharetypeimport.go
@@ -0,0 +1,48 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by applyconfiguration-gen. DO NOT EDIT.
+
+package v1alpha1
+
+// ShareTypeImportApplyConfiguration represents a declarative configuration of the ShareTypeImport type for use
+// with apply.
+type ShareTypeImportApplyConfiguration struct {
+ ID *string `json:"id,omitempty"`
+ Filter *ShareTypeFilterApplyConfiguration `json:"filter,omitempty"`
+}
+
+// ShareTypeImportApplyConfiguration constructs a declarative configuration of the ShareTypeImport type for use with
+// apply.
+func ShareTypeImport() *ShareTypeImportApplyConfiguration {
+ return &ShareTypeImportApplyConfiguration{}
+}
+
+// WithID sets the ID field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the ID field is set to the value of the last call.
+func (b *ShareTypeImportApplyConfiguration) WithID(value string) *ShareTypeImportApplyConfiguration {
+ b.ID = &value
+ return b
+}
+
+// WithFilter sets the Filter field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Filter field is set to the value of the last call.
+func (b *ShareTypeImportApplyConfiguration) WithFilter(value *ShareTypeFilterApplyConfiguration) *ShareTypeImportApplyConfiguration {
+ b.Filter = value
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/sharetyperesourcespec.go b/pkg/clients/applyconfiguration/api/v1alpha1/sharetyperesourcespec.go
new file mode 100644
index 000000000..9f635024b
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/sharetyperesourcespec.go
@@ -0,0 +1,70 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by applyconfiguration-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ apiv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+)
+
+// ShareTypeResourceSpecApplyConfiguration represents a declarative configuration of the ShareTypeResourceSpec type for use
+// with apply.
+type ShareTypeResourceSpecApplyConfiguration struct {
+ Name *apiv1alpha1.OpenStackName `json:"name,omitempty"`
+ IsPublic *bool `json:"isPublic,omitempty"`
+ DriverHandlesShareServers *bool `json:"driverHandlesShareServers,omitempty"`
+ SnapshotSupport *bool `json:"snapshotSupport,omitempty"`
+}
+
+// ShareTypeResourceSpecApplyConfiguration constructs a declarative configuration of the ShareTypeResourceSpec type for use with
+// apply.
+func ShareTypeResourceSpec() *ShareTypeResourceSpecApplyConfiguration {
+ return &ShareTypeResourceSpecApplyConfiguration{}
+}
+
+// WithName sets the Name field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Name field is set to the value of the last call.
+func (b *ShareTypeResourceSpecApplyConfiguration) WithName(value apiv1alpha1.OpenStackName) *ShareTypeResourceSpecApplyConfiguration {
+ b.Name = &value
+ return b
+}
+
+// WithIsPublic sets the IsPublic field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the IsPublic field is set to the value of the last call.
+func (b *ShareTypeResourceSpecApplyConfiguration) WithIsPublic(value bool) *ShareTypeResourceSpecApplyConfiguration {
+ b.IsPublic = &value
+ return b
+}
+
+// WithDriverHandlesShareServers sets the DriverHandlesShareServers field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the DriverHandlesShareServers field is set to the value of the last call.
+func (b *ShareTypeResourceSpecApplyConfiguration) WithDriverHandlesShareServers(value bool) *ShareTypeResourceSpecApplyConfiguration {
+ b.DriverHandlesShareServers = &value
+ return b
+}
+
+// WithSnapshotSupport sets the SnapshotSupport field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the SnapshotSupport field is set to the value of the last call.
+func (b *ShareTypeResourceSpecApplyConfiguration) WithSnapshotSupport(value bool) *ShareTypeResourceSpecApplyConfiguration {
+ b.SnapshotSupport = &value
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/sharetyperesourcestatus.go b/pkg/clients/applyconfiguration/api/v1alpha1/sharetyperesourcestatus.go
new file mode 100644
index 000000000..8e5bcf2f9
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/sharetyperesourcestatus.go
@@ -0,0 +1,63 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by applyconfiguration-gen. DO NOT EDIT.
+
+package v1alpha1
+
+// ShareTypeResourceStatusApplyConfiguration represents a declarative configuration of the ShareTypeResourceStatus type for use
+// with apply.
+type ShareTypeResourceStatusApplyConfiguration struct {
+ Name *string `json:"name,omitempty"`
+ IsPublic *bool `json:"isPublic,omitempty"`
+ ExtraSpecs map[string]string `json:"extraSpecs,omitempty"`
+}
+
+// ShareTypeResourceStatusApplyConfiguration constructs a declarative configuration of the ShareTypeResourceStatus type for use with
+// apply.
+func ShareTypeResourceStatus() *ShareTypeResourceStatusApplyConfiguration {
+ return &ShareTypeResourceStatusApplyConfiguration{}
+}
+
+// WithName sets the Name field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Name field is set to the value of the last call.
+func (b *ShareTypeResourceStatusApplyConfiguration) WithName(value string) *ShareTypeResourceStatusApplyConfiguration {
+ b.Name = &value
+ return b
+}
+
+// WithIsPublic sets the IsPublic field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the IsPublic field is set to the value of the last call.
+func (b *ShareTypeResourceStatusApplyConfiguration) WithIsPublic(value bool) *ShareTypeResourceStatusApplyConfiguration {
+ b.IsPublic = &value
+ return b
+}
+
+// WithExtraSpecs puts the entries into the ExtraSpecs field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, the entries provided by each call will be put on the ExtraSpecs field,
+// overwriting an existing map entries in ExtraSpecs field with the same key.
+func (b *ShareTypeResourceStatusApplyConfiguration) WithExtraSpecs(entries map[string]string) *ShareTypeResourceStatusApplyConfiguration {
+ if b.ExtraSpecs == nil && len(entries) > 0 {
+ b.ExtraSpecs = make(map[string]string, len(entries))
+ }
+ for k, v := range entries {
+ b.ExtraSpecs[k] = v
+ }
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/sharetypespec.go b/pkg/clients/applyconfiguration/api/v1alpha1/sharetypespec.go
new file mode 100644
index 000000000..52ec9df76
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/sharetypespec.go
@@ -0,0 +1,79 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by applyconfiguration-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ apiv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+)
+
+// ShareTypeSpecApplyConfiguration represents a declarative configuration of the ShareTypeSpec type for use
+// with apply.
+type ShareTypeSpecApplyConfiguration struct {
+ Import *ShareTypeImportApplyConfiguration `json:"import,omitempty"`
+ Resource *ShareTypeResourceSpecApplyConfiguration `json:"resource,omitempty"`
+ ManagementPolicy *apiv1alpha1.ManagementPolicy `json:"managementPolicy,omitempty"`
+ ManagedOptions *ManagedOptionsApplyConfiguration `json:"managedOptions,omitempty"`
+ CloudCredentialsRef *CloudCredentialsReferenceApplyConfiguration `json:"cloudCredentialsRef,omitempty"`
+}
+
+// ShareTypeSpecApplyConfiguration constructs a declarative configuration of the ShareTypeSpec type for use with
+// apply.
+func ShareTypeSpec() *ShareTypeSpecApplyConfiguration {
+ return &ShareTypeSpecApplyConfiguration{}
+}
+
+// WithImport sets the Import field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Import field is set to the value of the last call.
+func (b *ShareTypeSpecApplyConfiguration) WithImport(value *ShareTypeImportApplyConfiguration) *ShareTypeSpecApplyConfiguration {
+ b.Import = value
+ return b
+}
+
+// WithResource sets the Resource field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Resource field is set to the value of the last call.
+func (b *ShareTypeSpecApplyConfiguration) WithResource(value *ShareTypeResourceSpecApplyConfiguration) *ShareTypeSpecApplyConfiguration {
+ b.Resource = value
+ return b
+}
+
+// WithManagementPolicy sets the ManagementPolicy field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the ManagementPolicy field is set to the value of the last call.
+func (b *ShareTypeSpecApplyConfiguration) WithManagementPolicy(value apiv1alpha1.ManagementPolicy) *ShareTypeSpecApplyConfiguration {
+ b.ManagementPolicy = &value
+ return b
+}
+
+// WithManagedOptions sets the ManagedOptions field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the ManagedOptions field is set to the value of the last call.
+func (b *ShareTypeSpecApplyConfiguration) WithManagedOptions(value *ManagedOptionsApplyConfiguration) *ShareTypeSpecApplyConfiguration {
+ b.ManagedOptions = value
+ return b
+}
+
+// WithCloudCredentialsRef sets the CloudCredentialsRef field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the CloudCredentialsRef field is set to the value of the last call.
+func (b *ShareTypeSpecApplyConfiguration) WithCloudCredentialsRef(value *CloudCredentialsReferenceApplyConfiguration) *ShareTypeSpecApplyConfiguration {
+ b.CloudCredentialsRef = value
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/sharetypestatus.go b/pkg/clients/applyconfiguration/api/v1alpha1/sharetypestatus.go
new file mode 100644
index 000000000..1dac48008
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/sharetypestatus.go
@@ -0,0 +1,66 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by applyconfiguration-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ v1 "k8s.io/client-go/applyconfigurations/meta/v1"
+)
+
+// ShareTypeStatusApplyConfiguration represents a declarative configuration of the ShareTypeStatus type for use
+// with apply.
+type ShareTypeStatusApplyConfiguration struct {
+ Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"`
+ ID *string `json:"id,omitempty"`
+ Resource *ShareTypeResourceStatusApplyConfiguration `json:"resource,omitempty"`
+}
+
+// ShareTypeStatusApplyConfiguration constructs a declarative configuration of the ShareTypeStatus type for use with
+// apply.
+func ShareTypeStatus() *ShareTypeStatusApplyConfiguration {
+ return &ShareTypeStatusApplyConfiguration{}
+}
+
+// WithConditions adds the given value to the Conditions field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, values provided by each call will be appended to the Conditions field.
+func (b *ShareTypeStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *ShareTypeStatusApplyConfiguration {
+ for i := range values {
+ if values[i] == nil {
+ panic("nil value passed to WithConditions")
+ }
+ b.Conditions = append(b.Conditions, *values[i])
+ }
+ return b
+}
+
+// WithID sets the ID field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the ID field is set to the value of the last call.
+func (b *ShareTypeStatusApplyConfiguration) WithID(value string) *ShareTypeStatusApplyConfiguration {
+ b.ID = &value
+ return b
+}
+
+// WithResource sets the Resource field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Resource field is set to the value of the last call.
+func (b *ShareTypeStatusApplyConfiguration) WithResource(value *ShareTypeResourceStatusApplyConfiguration) *ShareTypeStatusApplyConfiguration {
+ b.Resource = value
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/internal/internal.go b/pkg/clients/applyconfiguration/internal/internal.go
index 45321b551..3ab4b55ab 100644
--- a/pkg/clients/applyconfiguration/internal/internal.go
+++ b/pkg/clients/applyconfiguration/internal/internal.go
@@ -3268,6 +3268,110 @@ var schemaYAML = typed.YAMLObject(`types:
- name: resource
type:
namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareNetworkResourceStatus
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareType
+ map:
+ fields:
+ - name: apiVersion
+ type:
+ scalar: string
+ - name: kind
+ type:
+ scalar: string
+ - name: metadata
+ type:
+ namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
+ default: {}
+ - name: spec
+ type:
+ namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareTypeSpec
+ default: {}
+ - name: status
+ type:
+ namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareTypeStatus
+ default: {}
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareTypeFilter
+ map:
+ fields:
+ - name: isPublic
+ type:
+ scalar: boolean
+ - name: name
+ type:
+ scalar: string
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareTypeImport
+ map:
+ fields:
+ - name: filter
+ type:
+ namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareTypeFilter
+ - name: id
+ type:
+ scalar: string
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareTypeResourceSpec
+ map:
+ fields:
+ - name: driverHandlesShareServers
+ type:
+ scalar: boolean
+ - name: isPublic
+ type:
+ scalar: boolean
+ - name: name
+ type:
+ scalar: string
+ - name: snapshotSupport
+ type:
+ scalar: boolean
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareTypeResourceStatus
+ map:
+ fields:
+ - name: extraSpecs
+ type:
+ map:
+ elementType:
+ scalar: string
+ - name: isPublic
+ type:
+ scalar: boolean
+ - name: name
+ type:
+ scalar: string
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareTypeSpec
+ map:
+ fields:
+ - name: cloudCredentialsRef
+ type:
+ namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.CloudCredentialsReference
+ default: {}
+ - name: import
+ type:
+ namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareTypeImport
+ - name: managedOptions
+ type:
+ namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ManagedOptions
+ - name: managementPolicy
+ type:
+ scalar: string
+ - name: resource
+ type:
+ namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareTypeResourceSpec
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareTypeStatus
+ map:
+ fields:
+ - name: conditions
+ type:
+ list:
+ elementType:
+ namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition
+ elementRelationship: associative
+ keys:
+ - type
+ - name: id
+ type:
+ scalar: string
+ - name: resource
+ type:
+ namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.ShareTypeResourceStatus
- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.Subnet
map:
fields:
diff --git a/pkg/clients/applyconfiguration/utils.go b/pkg/clients/applyconfiguration/utils.go
index 5d8f68cd9..1e05fa9b7 100644
--- a/pkg/clients/applyconfiguration/utils.go
+++ b/pkg/clients/applyconfiguration/utils.go
@@ -394,6 +394,20 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &apiv1alpha1.ShareNetworkSpecApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("ShareNetworkStatus"):
return &apiv1alpha1.ShareNetworkStatusApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("ShareType"):
+ return &apiv1alpha1.ShareTypeApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("ShareTypeFilter"):
+ return &apiv1alpha1.ShareTypeFilterApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("ShareTypeImport"):
+ return &apiv1alpha1.ShareTypeImportApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("ShareTypeResourceSpec"):
+ return &apiv1alpha1.ShareTypeResourceSpecApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("ShareTypeResourceStatus"):
+ return &apiv1alpha1.ShareTypeResourceStatusApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("ShareTypeSpec"):
+ return &apiv1alpha1.ShareTypeSpecApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("ShareTypeStatus"):
+ return &apiv1alpha1.ShareTypeStatusApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("Subnet"):
return &apiv1alpha1.SubnetApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("SubnetFilter"):
diff --git a/pkg/clients/clientset/clientset/typed/api/v1alpha1/api_client.go b/pkg/clients/clientset/clientset/typed/api/v1alpha1/api_client.go
index d5c517b1e..279d533ad 100644
--- a/pkg/clients/clientset/clientset/typed/api/v1alpha1/api_client.go
+++ b/pkg/clients/clientset/clientset/typed/api/v1alpha1/api_client.go
@@ -48,6 +48,7 @@ type OpenstackV1alpha1Interface interface {
ServerGroupsGetter
ServicesGetter
ShareNetworksGetter
+ ShareTypesGetter
SubnetsGetter
TrunksGetter
UsersGetter
@@ -140,6 +141,10 @@ func (c *OpenstackV1alpha1Client) ShareNetworks(namespace string) ShareNetworkIn
return newShareNetworks(c, namespace)
}
+func (c *OpenstackV1alpha1Client) ShareTypes(namespace string) ShareTypeInterface {
+ return newShareTypes(c, namespace)
+}
+
func (c *OpenstackV1alpha1Client) Subnets(namespace string) SubnetInterface {
return newSubnets(c, namespace)
}
diff --git a/pkg/clients/clientset/clientset/typed/api/v1alpha1/fake/fake_api_client.go b/pkg/clients/clientset/clientset/typed/api/v1alpha1/fake/fake_api_client.go
index f5dcb5da4..e1b6e0bd6 100644
--- a/pkg/clients/clientset/clientset/typed/api/v1alpha1/fake/fake_api_client.go
+++ b/pkg/clients/clientset/clientset/typed/api/v1alpha1/fake/fake_api_client.go
@@ -108,6 +108,10 @@ func (c *FakeOpenstackV1alpha1) ShareNetworks(namespace string) v1alpha1.ShareNe
return newFakeShareNetworks(c, namespace)
}
+func (c *FakeOpenstackV1alpha1) ShareTypes(namespace string) v1alpha1.ShareTypeInterface {
+ return newFakeShareTypes(c, namespace)
+}
+
func (c *FakeOpenstackV1alpha1) Subnets(namespace string) v1alpha1.SubnetInterface {
return newFakeSubnets(c, namespace)
}
diff --git a/pkg/clients/clientset/clientset/typed/api/v1alpha1/fake/fake_sharetype.go b/pkg/clients/clientset/clientset/typed/api/v1alpha1/fake/fake_sharetype.go
new file mode 100644
index 000000000..56d1a8c16
--- /dev/null
+++ b/pkg/clients/clientset/clientset/typed/api/v1alpha1/fake/fake_sharetype.go
@@ -0,0 +1,51 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+ apiv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/pkg/clients/applyconfiguration/api/v1alpha1"
+ typedapiv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/pkg/clients/clientset/clientset/typed/api/v1alpha1"
+ gentype "k8s.io/client-go/gentype"
+)
+
+// fakeShareTypes implements ShareTypeInterface
+type fakeShareTypes struct {
+ *gentype.FakeClientWithListAndApply[*v1alpha1.ShareType, *v1alpha1.ShareTypeList, *apiv1alpha1.ShareTypeApplyConfiguration]
+ Fake *FakeOpenstackV1alpha1
+}
+
+func newFakeShareTypes(fake *FakeOpenstackV1alpha1, namespace string) typedapiv1alpha1.ShareTypeInterface {
+ return &fakeShareTypes{
+ gentype.NewFakeClientWithListAndApply[*v1alpha1.ShareType, *v1alpha1.ShareTypeList, *apiv1alpha1.ShareTypeApplyConfiguration](
+ fake.Fake,
+ namespace,
+ v1alpha1.SchemeGroupVersion.WithResource("sharetypes"),
+ v1alpha1.SchemeGroupVersion.WithKind("ShareType"),
+ func() *v1alpha1.ShareType { return &v1alpha1.ShareType{} },
+ func() *v1alpha1.ShareTypeList { return &v1alpha1.ShareTypeList{} },
+ func(dst, src *v1alpha1.ShareTypeList) { dst.ListMeta = src.ListMeta },
+ func(list *v1alpha1.ShareTypeList) []*v1alpha1.ShareType { return gentype.ToPointerSlice(list.Items) },
+ func(list *v1alpha1.ShareTypeList, items []*v1alpha1.ShareType) {
+ list.Items = gentype.FromPointerSlice(items)
+ },
+ ),
+ fake,
+ }
+}
diff --git a/pkg/clients/clientset/clientset/typed/api/v1alpha1/generated_expansion.go b/pkg/clients/clientset/clientset/typed/api/v1alpha1/generated_expansion.go
index e13858a9c..89cd7baff 100644
--- a/pkg/clients/clientset/clientset/typed/api/v1alpha1/generated_expansion.go
+++ b/pkg/clients/clientset/clientset/typed/api/v1alpha1/generated_expansion.go
@@ -58,6 +58,8 @@ type ServiceExpansion interface{}
type ShareNetworkExpansion interface{}
+type ShareTypeExpansion interface{}
+
type SubnetExpansion interface{}
type TrunkExpansion interface{}
diff --git a/pkg/clients/clientset/clientset/typed/api/v1alpha1/sharetype.go b/pkg/clients/clientset/clientset/typed/api/v1alpha1/sharetype.go
new file mode 100644
index 000000000..7e11ba45e
--- /dev/null
+++ b/pkg/clients/clientset/clientset/typed/api/v1alpha1/sharetype.go
@@ -0,0 +1,74 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ context "context"
+
+ apiv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+ applyconfigurationapiv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/pkg/clients/applyconfiguration/api/v1alpha1"
+ scheme "github.com/k-orc/openstack-resource-controller/v2/pkg/clients/clientset/clientset/scheme"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ gentype "k8s.io/client-go/gentype"
+)
+
+// ShareTypesGetter has a method to return a ShareTypeInterface.
+// A group's client should implement this interface.
+type ShareTypesGetter interface {
+ ShareTypes(namespace string) ShareTypeInterface
+}
+
+// ShareTypeInterface has methods to work with ShareType resources.
+type ShareTypeInterface interface {
+ Create(ctx context.Context, shareType *apiv1alpha1.ShareType, opts v1.CreateOptions) (*apiv1alpha1.ShareType, error)
+ Update(ctx context.Context, shareType *apiv1alpha1.ShareType, opts v1.UpdateOptions) (*apiv1alpha1.ShareType, error)
+ // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+ UpdateStatus(ctx context.Context, shareType *apiv1alpha1.ShareType, opts v1.UpdateOptions) (*apiv1alpha1.ShareType, error)
+ Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
+ DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
+ Get(ctx context.Context, name string, opts v1.GetOptions) (*apiv1alpha1.ShareType, error)
+ List(ctx context.Context, opts v1.ListOptions) (*apiv1alpha1.ShareTypeList, error)
+ Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
+ Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *apiv1alpha1.ShareType, err error)
+ Apply(ctx context.Context, shareType *applyconfigurationapiv1alpha1.ShareTypeApplyConfiguration, opts v1.ApplyOptions) (result *apiv1alpha1.ShareType, err error)
+ // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
+ ApplyStatus(ctx context.Context, shareType *applyconfigurationapiv1alpha1.ShareTypeApplyConfiguration, opts v1.ApplyOptions) (result *apiv1alpha1.ShareType, err error)
+ ShareTypeExpansion
+}
+
+// shareTypes implements ShareTypeInterface
+type shareTypes struct {
+ *gentype.ClientWithListAndApply[*apiv1alpha1.ShareType, *apiv1alpha1.ShareTypeList, *applyconfigurationapiv1alpha1.ShareTypeApplyConfiguration]
+}
+
+// newShareTypes returns a ShareTypes
+func newShareTypes(c *OpenstackV1alpha1Client, namespace string) *shareTypes {
+ return &shareTypes{
+ gentype.NewClientWithListAndApply[*apiv1alpha1.ShareType, *apiv1alpha1.ShareTypeList, *applyconfigurationapiv1alpha1.ShareTypeApplyConfiguration](
+ "sharetypes",
+ c.RESTClient(),
+ scheme.ParameterCodec,
+ namespace,
+ func() *apiv1alpha1.ShareType { return &apiv1alpha1.ShareType{} },
+ func() *apiv1alpha1.ShareTypeList { return &apiv1alpha1.ShareTypeList{} },
+ ),
+ }
+}
diff --git a/pkg/clients/informers/externalversions/api/v1alpha1/interface.go b/pkg/clients/informers/externalversions/api/v1alpha1/interface.go
index 2e9f92392..826038651 100644
--- a/pkg/clients/informers/externalversions/api/v1alpha1/interface.go
+++ b/pkg/clients/informers/externalversions/api/v1alpha1/interface.go
@@ -64,6 +64,8 @@ type Interface interface {
Services() ServiceInformer
// ShareNetworks returns a ShareNetworkInformer.
ShareNetworks() ShareNetworkInformer
+ // ShareTypes returns a ShareTypeInformer.
+ ShareTypes() ShareTypeInformer
// Subnets returns a SubnetInformer.
Subnets() SubnetInformer
// Trunks returns a TrunkInformer.
@@ -187,6 +189,11 @@ func (v *version) ShareNetworks() ShareNetworkInformer {
return &shareNetworkInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
+// ShareTypes returns a ShareTypeInformer.
+func (v *version) ShareTypes() ShareTypeInformer {
+ return &shareTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
+}
+
// Subnets returns a SubnetInformer.
func (v *version) Subnets() SubnetInformer {
return &subnetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
diff --git a/pkg/clients/informers/externalversions/api/v1alpha1/sharetype.go b/pkg/clients/informers/externalversions/api/v1alpha1/sharetype.go
new file mode 100644
index 000000000..c1a1d35b3
--- /dev/null
+++ b/pkg/clients/informers/externalversions/api/v1alpha1/sharetype.go
@@ -0,0 +1,102 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by informer-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ context "context"
+ time "time"
+
+ v2apiv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+ clientset "github.com/k-orc/openstack-resource-controller/v2/pkg/clients/clientset/clientset"
+ internalinterfaces "github.com/k-orc/openstack-resource-controller/v2/pkg/clients/informers/externalversions/internalinterfaces"
+ apiv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/pkg/clients/listers/api/v1alpha1"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ runtime "k8s.io/apimachinery/pkg/runtime"
+ watch "k8s.io/apimachinery/pkg/watch"
+ cache "k8s.io/client-go/tools/cache"
+)
+
+// ShareTypeInformer provides access to a shared informer and lister for
+// ShareTypes.
+type ShareTypeInformer interface {
+ Informer() cache.SharedIndexInformer
+ Lister() apiv1alpha1.ShareTypeLister
+}
+
+type shareTypeInformer struct {
+ factory internalinterfaces.SharedInformerFactory
+ tweakListOptions internalinterfaces.TweakListOptionsFunc
+ namespace string
+}
+
+// NewShareTypeInformer constructs a new informer for ShareType type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewShareTypeInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
+ return NewFilteredShareTypeInformer(client, namespace, resyncPeriod, indexers, nil)
+}
+
+// NewFilteredShareTypeInformer constructs a new informer for ShareType type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewFilteredShareTypeInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
+ return cache.NewSharedIndexInformer(
+ &cache.ListWatch{
+ ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.OpenstackV1alpha1().ShareTypes(namespace).List(context.Background(), options)
+ },
+ WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.OpenstackV1alpha1().ShareTypes(namespace).Watch(context.Background(), options)
+ },
+ ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.OpenstackV1alpha1().ShareTypes(namespace).List(ctx, options)
+ },
+ WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.OpenstackV1alpha1().ShareTypes(namespace).Watch(ctx, options)
+ },
+ },
+ &v2apiv1alpha1.ShareType{},
+ resyncPeriod,
+ indexers,
+ )
+}
+
+func (f *shareTypeInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
+ return NewFilteredShareTypeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
+}
+
+func (f *shareTypeInformer) Informer() cache.SharedIndexInformer {
+ return f.factory.InformerFor(&v2apiv1alpha1.ShareType{}, f.defaultInformer)
+}
+
+func (f *shareTypeInformer) Lister() apiv1alpha1.ShareTypeLister {
+ return apiv1alpha1.NewShareTypeLister(f.Informer().GetIndexer())
+}
diff --git a/pkg/clients/informers/externalversions/generic.go b/pkg/clients/informers/externalversions/generic.go
index fb3637f1e..48e53486a 100644
--- a/pkg/clients/informers/externalversions/generic.go
+++ b/pkg/clients/informers/externalversions/generic.go
@@ -93,6 +93,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Openstack().V1alpha1().Services().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("sharenetworks"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Openstack().V1alpha1().ShareNetworks().Informer()}, nil
+ case v1alpha1.SchemeGroupVersion.WithResource("sharetypes"):
+ return &genericInformer{resource: resource.GroupResource(), informer: f.Openstack().V1alpha1().ShareTypes().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("subnets"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Openstack().V1alpha1().Subnets().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("trunks"):
diff --git a/pkg/clients/listers/api/v1alpha1/expansion_generated.go b/pkg/clients/listers/api/v1alpha1/expansion_generated.go
index 4d7043581..588c99988 100644
--- a/pkg/clients/listers/api/v1alpha1/expansion_generated.go
+++ b/pkg/clients/listers/api/v1alpha1/expansion_generated.go
@@ -178,6 +178,14 @@ type ShareNetworkListerExpansion interface{}
// ShareNetworkNamespaceLister.
type ShareNetworkNamespaceListerExpansion interface{}
+// ShareTypeListerExpansion allows custom methods to be added to
+// ShareTypeLister.
+type ShareTypeListerExpansion interface{}
+
+// ShareTypeNamespaceListerExpansion allows custom methods to be added to
+// ShareTypeNamespaceLister.
+type ShareTypeNamespaceListerExpansion interface{}
+
// SubnetListerExpansion allows custom methods to be added to
// SubnetLister.
type SubnetListerExpansion interface{}
diff --git a/pkg/clients/listers/api/v1alpha1/sharetype.go b/pkg/clients/listers/api/v1alpha1/sharetype.go
new file mode 100644
index 000000000..11fb0fb31
--- /dev/null
+++ b/pkg/clients/listers/api/v1alpha1/sharetype.go
@@ -0,0 +1,70 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Code generated by lister-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ apiv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+ labels "k8s.io/apimachinery/pkg/labels"
+ listers "k8s.io/client-go/listers"
+ cache "k8s.io/client-go/tools/cache"
+)
+
+// ShareTypeLister helps list ShareTypes.
+// All objects returned here must be treated as read-only.
+type ShareTypeLister interface {
+ // List lists all ShareTypes in the indexer.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*apiv1alpha1.ShareType, err error)
+ // ShareTypes returns an object that can list and get ShareTypes.
+ ShareTypes(namespace string) ShareTypeNamespaceLister
+ ShareTypeListerExpansion
+}
+
+// shareTypeLister implements the ShareTypeLister interface.
+type shareTypeLister struct {
+ listers.ResourceIndexer[*apiv1alpha1.ShareType]
+}
+
+// NewShareTypeLister returns a new ShareTypeLister.
+func NewShareTypeLister(indexer cache.Indexer) ShareTypeLister {
+ return &shareTypeLister{listers.New[*apiv1alpha1.ShareType](indexer, apiv1alpha1.Resource("sharetype"))}
+}
+
+// ShareTypes returns an object that can list and get ShareTypes.
+func (s *shareTypeLister) ShareTypes(namespace string) ShareTypeNamespaceLister {
+ return shareTypeNamespaceLister{listers.NewNamespaced[*apiv1alpha1.ShareType](s.ResourceIndexer, namespace)}
+}
+
+// ShareTypeNamespaceLister helps list and get ShareTypes.
+// All objects returned here must be treated as read-only.
+type ShareTypeNamespaceLister interface {
+ // List lists all ShareTypes in the indexer for a given namespace.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*apiv1alpha1.ShareType, err error)
+ // Get retrieves the ShareType from the indexer for a given namespace and name.
+ // Objects returned here must be treated as read-only.
+ Get(name string) (*apiv1alpha1.ShareType, error)
+ ShareTypeNamespaceListerExpansion
+}
+
+// shareTypeNamespaceLister implements the ShareTypeNamespaceLister
+// interface.
+type shareTypeNamespaceLister struct {
+ listers.ResourceIndexer[*apiv1alpha1.ShareType]
+}
diff --git a/test/apivalidations/sharetype_test.go b/test/apivalidations/sharetype_test.go
new file mode 100644
index 000000000..73389a620
--- /dev/null
+++ b/test/apivalidations/sharetype_test.go
@@ -0,0 +1,105 @@
+/*
+Copyright The ORC Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package apivalidations
+
+import (
+ . "github.com/onsi/ginkgo/v2"
+ corev1 "k8s.io/api/core/v1"
+ "sigs.k8s.io/controller-runtime/pkg/client"
+
+ orcv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+ applyconfigv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/pkg/clients/applyconfiguration/api/v1alpha1"
+)
+
+const (
+ sharetypeName = "sharetype"
+ sharetypeID = "265c9e4f-0f5a-46e4-9f3f-fb8de25ae120"
+)
+
+func sharetypeStub(namespace *corev1.Namespace) *orcv1alpha1.ShareType {
+ obj := &orcv1alpha1.ShareType{}
+ obj.Name = sharetypeName
+ obj.Namespace = namespace.Name
+ return obj
+}
+
+func testShareTypeResource() *applyconfigv1alpha1.ShareTypeResourceSpecApplyConfiguration {
+ return applyconfigv1alpha1.ShareTypeResourceSpec()
+}
+
+func baseShareTypePatch(obj client.Object) *applyconfigv1alpha1.ShareTypeApplyConfiguration {
+ return applyconfigv1alpha1.ShareType(obj.GetName(), obj.GetNamespace()).
+ WithSpec(applyconfigv1alpha1.ShareTypeSpec().
+ WithCloudCredentialsRef(testCredentials()))
+}
+
+func testShareTypeImport() *applyconfigv1alpha1.ShareTypeImportApplyConfiguration {
+ return applyconfigv1alpha1.ShareTypeImport().WithID(sharetypeID)
+}
+
+var _ = Describe("ORC ShareType API validations", func() {
+ var namespace *corev1.Namespace
+ BeforeEach(func() {
+ namespace = createNamespace()
+ })
+
+ runManagementPolicyTests(func() *corev1.Namespace { return namespace }, managementPolicyTestArgs[*applyconfigv1alpha1.ShareTypeApplyConfiguration]{
+ createObject: func(ns *corev1.Namespace) client.Object { return sharetypeStub(ns) },
+ basePatch: func(obj client.Object) *applyconfigv1alpha1.ShareTypeApplyConfiguration {
+ return baseShareTypePatch(obj)
+ },
+ applyResource: func(p *applyconfigv1alpha1.ShareTypeApplyConfiguration) {
+ p.Spec.WithResource(testShareTypeResource())
+ },
+ applyImport: func(p *applyconfigv1alpha1.ShareTypeApplyConfiguration) {
+ p.Spec.WithImport(testShareTypeImport())
+ },
+ applyEmptyImport: func(p *applyconfigv1alpha1.ShareTypeApplyConfiguration) {
+ p.Spec.WithImport(applyconfigv1alpha1.ShareTypeImport())
+ },
+ applyEmptyFilter: func(p *applyconfigv1alpha1.ShareTypeApplyConfiguration) {
+ p.Spec.WithImport(applyconfigv1alpha1.ShareTypeImport().WithFilter(applyconfigv1alpha1.ShareTypeFilter()))
+ },
+ applyValidFilter: func(p *applyconfigv1alpha1.ShareTypeApplyConfiguration) {
+ p.Spec.WithImport(applyconfigv1alpha1.ShareTypeImport().WithFilter(applyconfigv1alpha1.ShareTypeFilter().WithName("foo")))
+ },
+ applyManaged: func(p *applyconfigv1alpha1.ShareTypeApplyConfiguration) {
+ p.Spec.WithManagementPolicy(orcv1alpha1.ManagementPolicyManaged)
+ },
+ applyUnmanaged: func(p *applyconfigv1alpha1.ShareTypeApplyConfiguration) {
+ p.Spec.WithManagementPolicy(orcv1alpha1.ManagementPolicyUnmanaged)
+ },
+ applyManagedOptions: func(p *applyconfigv1alpha1.ShareTypeApplyConfiguration) {
+ p.Spec.WithManagedOptions(applyconfigv1alpha1.ManagedOptions().WithOnDelete(orcv1alpha1.OnDeleteDetach))
+ },
+ getManagementPolicy: func(obj client.Object) orcv1alpha1.ManagementPolicy {
+ return obj.(*orcv1alpha1.ShareType).Spec.ManagementPolicy
+ },
+ getOnDelete: func(obj client.Object) orcv1alpha1.OnDelete {
+ return obj.(*orcv1alpha1.ShareType).Spec.ManagedOptions.OnDelete
+ },
+ })
+
+ // TODO(scaffolding): Add more resource-specific validation tests.
+ // Some common things to test:
+ // - Immutability of fields with `self == oldSelf` validation
+ // - Enum validation (valid and invalid values)
+ // - Numeric range validation (min/max bounds)
+ // - Tag uniqueness (if the resource has tags with listType=set)
+ // - Format validation (CIDR, UUID, etc.)
+ // - Cross-field validation rules
+})
diff --git a/website/docs/crd-reference.md b/website/docs/crd-reference.md
index 1da353f71..f18f831d5 100644
--- a/website/docs/crd-reference.md
+++ b/website/docs/crd-reference.md
@@ -30,6 +30,7 @@ Package v1alpha1 contains API Schema definitions for the openstack v1alpha1 API
- [ServerGroup](#servergroup)
- [Service](#service)
- [ShareNetwork](#sharenetwork)
+- [ShareType](#sharetype)
- [Subnet](#subnet)
- [Trunk](#trunk)
- [User](#user)
@@ -521,6 +522,7 @@ _Appears in:_
- [ServerSpec](#serverspec)
- [ServiceSpec](#servicespec)
- [ShareNetworkSpec](#sharenetworkspec)
+- [ShareTypeSpec](#sharetypespec)
- [SubnetSpec](#subnetspec)
- [TrunkSpec](#trunkspec)
- [UserSpec](#userspec)
@@ -2242,6 +2244,7 @@ _Appears in:_
- [ServerSpec](#serverspec)
- [ServiceSpec](#servicespec)
- [ShareNetworkSpec](#sharenetworkspec)
+- [ShareTypeSpec](#sharetypespec)
- [SubnetSpec](#subnetspec)
- [TrunkSpec](#trunkspec)
- [UserSpec](#userspec)
@@ -2282,6 +2285,7 @@ _Appears in:_
- [ServerSpec](#serverspec)
- [ServiceSpec](#servicespec)
- [ShareNetworkSpec](#sharenetworkspec)
+- [ShareTypeSpec](#sharetypespec)
- [SubnetSpec](#subnetspec)
- [TrunkSpec](#trunkspec)
- [UserSpec](#userspec)
@@ -2593,6 +2597,8 @@ _Appears in:_
- [ServiceResourceSpec](#serviceresourcespec)
- [ShareNetworkFilter](#sharenetworkfilter)
- [ShareNetworkResourceSpec](#sharenetworkresourcespec)
+- [ShareTypeFilter](#sharetypefilter)
+- [ShareTypeResourceSpec](#sharetyperesourcespec)
- [SubnetFilter](#subnetfilter)
- [SubnetResourceSpec](#subnetresourcespec)
- [TrunkFilter](#trunkfilter)
@@ -4401,6 +4407,139 @@ _Appears in:_
| `resource` _[ShareNetworkResourceStatus](#sharenetworkresourcestatus)_ | resource contains the observed state of the OpenStack resource. | | Optional: \{\}
|
+#### ShareType
+
+
+
+ShareType is the Schema for an ORC resource.
+
+
+
+
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `apiVersion` _string_ | `openstack.k-orc.cloud/v1alpha1` | | |
+| `kind` _string_ | `ShareType` | | |
+| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | Optional: \{\}
|
+| `spec` _[ShareTypeSpec](#sharetypespec)_ | spec specifies the desired state of the resource. | | Required: \{\}
|
+| `status` _[ShareTypeStatus](#sharetypestatus)_ | status defines the observed state of the resource. | | Optional: \{\}
|
+
+
+#### ShareTypeFilter
+
+
+
+ShareTypeFilter defines an existing resource by its properties
+
+_Validation:_
+- MinProperties: 1
+
+_Appears in:_
+- [ShareTypeImport](#sharetypeimport)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `name` _[OpenStackName](#openstackname)_ | name of the existing resource | | MaxLength: 255
MinLength: 1
Pattern: `^[^,]+$`
Optional: \{\}
|
+| `isPublic` _boolean_ | isPublic selects public types, private types, or both | | Optional: \{\}
|
+
+
+#### ShareTypeImport
+
+
+
+ShareTypeImport specifies an existing resource which will be imported instead of
+creating a new one
+
+_Validation:_
+- MaxProperties: 1
+- MinProperties: 1
+
+_Appears in:_
+- [ShareTypeSpec](#sharetypespec)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `id` _string_ | id contains the unique identifier of an existing OpenStack resource. Note
that when specifying an import by ID, the resource MUST already exist.
The ORC object will enter an error state if the resource does not exist. | | Format: uuid
MaxLength: 36
Optional: \{\}
|
+| `filter` _[ShareTypeFilter](#sharetypefilter)_ | filter contains a resource query which is expected to return a single
result. The controller will continue to retry if filter returns no
results. If filter returns multiple results the controller will set an
error state and will not continue to retry. | | MinProperties: 1
Optional: \{\}
|
+
+
+#### ShareTypeResourceSpec
+
+
+
+ShareTypeResourceSpec contains the desired state of the resource.
+All fields are immutable after creation.
+
+
+
+_Appears in:_
+- [ShareTypeSpec](#sharetypespec)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `name` _[OpenStackName](#openstackname)_ | name will be the name of the created resource. If not specified, the
name of the ORC object will be used. | | MaxLength: 255
MinLength: 1
Pattern: `^[^,]+$`
Optional: \{\}
|
+| `isPublic` _boolean_ | isPublic indicates whether a share type is publicly accessible. | true | Optional: \{\}
|
+| `driverHandlesShareServers` _boolean_ | driverHandlesShareServers defines the driver mode for share server, or storage, life cycle management.
This is a required extra specification for share types. | true | Optional: \{\}
|
+| `snapshotSupport` _boolean_ | snapshotSupport filters back ends by whether they do or do not support share snapshots. | | Optional: \{\}
|
+
+
+#### ShareTypeResourceStatus
+
+
+
+ShareTypeResourceStatus represents the observed state of the resource.
+
+
+
+_Appears in:_
+- [ShareTypeStatus](#sharetypestatus)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `name` _string_ | name is a Human-readable name for the resource. Might not be unique. | | MaxLength: 1024
Optional: \{\}
|
+| `isPublic` _boolean_ | isPublic indicates whether a share type is publicly accessible. | | Optional: \{\}
|
+| `extraSpecs` _object (keys:string, values:string)_ | extraSpecs contains the extra specifications for the share type. | | Optional: \{\}
|
+
+
+#### ShareTypeSpec
+
+
+
+ShareTypeSpec defines the desired state of an ORC object.
+
+
+
+_Appears in:_
+- [ShareType](#sharetype)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `import` _[ShareTypeImport](#sharetypeimport)_ | import refers to an existing OpenStack resource which will be imported instead of
creating a new one. | | MaxProperties: 1
MinProperties: 1
Optional: \{\}
|
+| `resource` _[ShareTypeResourceSpec](#sharetyperesourcespec)_ | resource specifies the desired state of the resource.
resource may not be specified if the management policy is `unmanaged`.
resource must be specified if the management policy is `managed`. | | Optional: \{\}
|
+| `managementPolicy` _[ManagementPolicy](#managementpolicy)_ | managementPolicy defines how ORC will treat the object. Valid values are
`managed`: ORC will create, update, and delete the resource; `unmanaged`:
ORC will import an existing resource, and will not apply updates to it or
delete it. | managed | Enum: [managed unmanaged]
Optional: \{\}
|
+| `managedOptions` _[ManagedOptions](#managedoptions)_ | managedOptions specifies options which may be applied to managed objects. | | Optional: \{\}
|
+| `cloudCredentialsRef` _[CloudCredentialsReference](#cloudcredentialsreference)_ | cloudCredentialsRef points to a secret containing OpenStack credentials | | Required: \{\}
|
+
+
+#### ShareTypeStatus
+
+
+
+ShareTypeStatus defines the observed state of an ORC resource.
+
+
+
+_Appears in:_
+- [ShareType](#sharetype)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#condition-v1-meta) array_ | conditions represents the observed status of the object.
Known .status.conditions.type are: "Available", "Progressing"
Available represents the availability of the OpenStack resource. If it is
true then the resource is ready for use.
Progressing indicates whether the controller is still attempting to
reconcile the current state of the OpenStack resource to the desired
state. Progressing will be False either because the desired state has
been achieved, or because some terminal error prevents it from ever being
achieved and the controller is no longer attempting to reconcile. If
Progressing is True, an observer waiting on the resource should continue
to wait. | | MaxItems: 32
Optional: \{\}
|
+| `id` _string_ | id is the unique identifier of the OpenStack resource. | | MaxLength: 1024
Optional: \{\}
|
+| `resource` _[ShareTypeResourceStatus](#sharetyperesourcestatus)_ | resource contains the observed state of the OpenStack resource. | | Optional: \{\}
|
+
+
#### Subnet