diff --git a/Makefile b/Makefile
index 37b4913a..31d24744 100644
--- a/Makefile
+++ b/Makefile
@@ -316,7 +316,7 @@ CONTROLLER_TOOLS_VERSION ?= v0.17.1
ENVTEST_VERSION ?= release-0.22
GOLANGCI_LINT_VERSION ?= v2.7.2
KAL_VERSION ?= v0.0.0-20250924094418-502783c08f9d
-MOCKGEN_VERSION ?= v0.5.0
+MOCKGEN_VERSION ?= v0.6.0
KUTTL_VERSION ?= v0.23.0
GOVULNCHECK_VERSION ?= v1.1.4
OPERATOR_SDK_VERSION ?= v1.41.1
diff --git a/PROJECT b/PROJECT
index 8d6e2c12..3d09e3c3 100644
--- a/PROJECT
+++ b/PROJECT
@@ -144,6 +144,14 @@ resources:
kind: Subnet
path: github.com/k-orc/openstack-resource-controller/api/v1alpha1
version: v1alpha1
+- api:
+ crdVersion: v1
+ namespaced: true
+ domain: k-orc.cloud
+ group: openstack
+ kind: Trunk
+ path: github.com/k-orc/openstack-resource-controller/api/v1alpha1
+ version: v1alpha1
- api:
crdVersion: v1
namespaced: true
diff --git a/README.md b/README.md
index 26c73737..4060d87f 100644
--- a/README.md
+++ b/README.md
@@ -83,6 +83,7 @@ kubectl delete -f $ORC_RELEASE
| server group | | ✔ | ✔ |
| service | | ✔ | ✔ |
| subnet | | ◐ | ◐ |
+| trunk | | ✔ | ✔ |
| volume | | ◐ | ◐ |
| volume type | | ◐ | ◐ |
diff --git a/api/v1alpha1/trunk_types.go b/api/v1alpha1/trunk_types.go
new file mode 100644
index 00000000..07c5f45c
--- /dev/null
+++ b/api/v1alpha1/trunk_types.go
@@ -0,0 +1,184 @@
+/*
+Copyright 2025 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
+// TrunkSubportSpec represents a subport to attach to a trunk.
+// It maps to gophercloud's trunks.Subport.
+type TrunkSubportSpec struct {
+ // portRef is a reference to the ORC Port that will be attached as a subport.
+ // +required
+ PortRef KubernetesNameRef `json:"portRef"`
+
+ // segmentationID is the segmentation ID for the subport (e.g. VLAN ID).
+ // +required
+ // +kubebuilder:validation:Minimum:=1
+ // +kubebuilder:validation:Maximum:=4094
+ SegmentationID int32 `json:"segmentationID"`
+
+ // segmentationType is the segmentation type for the subport (e.g. vlan).
+ // +required
+ // +kubebuilder:validation:MinLength:=1
+ // +kubebuilder:validation:MaxLength:=255
+ SegmentationType string `json:"segmentationType"`
+}
+
+// TrunkSubportStatus represents an attached subport on a trunk.
+// It maps to gophercloud's trunks.Subport.
+type TrunkSubportStatus struct {
+ // portID is the OpenStack ID of the Port attached as a subport.
+ // +kubebuilder:validation:MaxLength=1024
+ // +optional
+ PortID string `json:"portID,omitempty"`
+
+ // segmentationID is the segmentation ID for the subport (e.g. VLAN ID).
+ // +optional
+ SegmentationID int32 `json:"segmentationID,omitempty"`
+
+ // segmentationType is the segmentation type for the subport (e.g. vlan).
+ // +kubebuilder:validation:MaxLength=1024
+ // +optional
+ SegmentationType string `json:"segmentationType,omitempty"`
+}
+
+// TrunkResourceSpec contains the desired state of the resource.
+type TrunkResourceSpec 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"`
+
+ // description is a human-readable description for the resource.
+ // +optional
+ Description *NeutronDescription `json:"description,omitempty"`
+
+ // portRef is a reference to the ORC Port which this resource is associated with.
+ // +required
+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="portRef is immutable"
+ PortRef KubernetesNameRef `json:"portRef,omitempty"`
+
+ // projectRef is a reference to the ORC Project which this resource is associated with.
+ // +optional
+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="projectRef is immutable"
+ ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
+
+ // adminStateUp is the administrative state of the trunk. If false (down),
+ // the trunk does not forward packets.
+ // +optional
+ AdminStateUp *bool `json:"adminStateUp,omitempty"`
+
+ // subports is the list of ports to attach to the trunk.
+ //
+ // NOTE: ORC currently does not implement reconcile logic for subport updates
+ // (Neutron uses dedicated add/remove subport APIs). This field is immutable
+ // until that behavior is implemented in the controller.
+ // +optional
+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="subports is immutable"
+ // +kubebuilder:validation:MaxItems:=1024
+ // +listType=atomic
+ Subports []TrunkSubportSpec `json:"subports,omitempty"`
+
+ // tags is a list of Neutron tags to apply to the trunk.
+ //
+ // NOTE: ORC does not currently reconcile tag updates for Trunk.
+ // +kubebuilder:validation:MaxItems:=64
+ // +listType=set
+ // +optional
+ // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="tags is immutable"
+ Tags []NeutronTag `json:"tags,omitempty"`
+}
+
+// TrunkFilter defines an existing resource by its properties
+// +kubebuilder:validation:MinProperties:=1
+type TrunkFilter struct {
+ // name of the existing resource
+ // +optional
+ Name *OpenStackName `json:"name,omitempty"`
+
+ // description of the existing resource
+ // +optional
+ Description *NeutronDescription `json:"description,omitempty"`
+
+ // portRef is a reference to the ORC Port which this resource is associated with.
+ // +optional
+ PortRef *KubernetesNameRef `json:"portRef,omitempty"`
+
+ // projectRef is a reference to the ORC Project which this resource is associated with.
+ // +optional
+ ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
+
+ // status indicates whether the trunk is currently operational. Possible values include
+ // `ACTIVE', `DOWN', `BUILD', `DEGRADED' or `ERROR'. Plug-ins might define additional values.
+ // +optional
+ Status *string `json:"status,omitempty"`
+
+ // adminStateUp is the administrative state of the trunk.
+ // +optional
+ AdminStateUp *bool `json:"adminStateUp,omitempty"`
+
+ FilterByNeutronTags `json:",inline"`
+}
+
+// TrunkResourceStatus represents the observed state of the resource.
+type TrunkResourceStatus struct {
+ // name is a Human-readable name for the resource. Might not be unique.
+ // +kubebuilder:validation:MaxLength=1024
+ // +optional
+ Name string `json:"name,omitempty"`
+
+ // description is a human-readable description for the resource.
+ // +kubebuilder:validation:MaxLength=1024
+ // +optional
+ Description string `json:"description,omitempty"`
+
+ // portID is the ID of the Port to which the resource is associated.
+ // +kubebuilder:validation:MaxLength=1024
+ // +optional
+ PortID string `json:"portID,omitempty"`
+
+ // projectID is the ID of the Project to which the resource is associated.
+ // +kubebuilder:validation:MaxLength=1024
+ // +optional
+ ProjectID string `json:"projectID,omitempty"`
+
+ // tenantID is the project owner of the trunk (alias of projectID in some deployments).
+ // +kubebuilder:validation:MaxLength=1024
+ // +optional
+ TenantID string `json:"tenantID,omitempty"`
+
+ // status indicates whether the trunk is currently operational.
+ // +kubebuilder:validation:MaxLength=1024
+ // +optional
+ Status string `json:"status,omitempty"`
+
+ // tags is the list of tags on the resource.
+ // +kubebuilder:validation:MaxItems=64
+ // +kubebuilder:validation:items:MaxLength=1024
+ // +listType=atomic
+ // +optional
+ Tags []string `json:"tags,omitempty"`
+
+ NeutronStatusMetadata `json:",inline"`
+
+ // adminStateUp is the administrative state of the trunk.
+ // +optional
+ AdminStateUp *bool `json:"adminStateUp,omitempty"`
+
+ // subports is a list of ports associated with the trunk.
+ // +kubebuilder:validation:MaxItems=1024
+ // +listType=atomic
+ // +optional
+ Subports []TrunkSubportStatus `json:"subports,omitempty"`
+}
diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go
index 67bfeab8..dac611de 100644
--- a/api/v1alpha1/zz_generated.deepcopy.go
+++ b/api/v1alpha1/zz_generated.deepcopy.go
@@ -4959,6 +4959,305 @@ func (in *SubnetStatus) DeepCopy() *SubnetStatus {
return out
}
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Trunk) DeepCopyInto(out *Trunk) {
+ *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 Trunk.
+func (in *Trunk) DeepCopy() *Trunk {
+ if in == nil {
+ return nil
+ }
+ out := new(Trunk)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *Trunk) 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 *TrunkFilter) DeepCopyInto(out *TrunkFilter) {
+ *out = *in
+ if in.Name != nil {
+ in, out := &in.Name, &out.Name
+ *out = new(OpenStackName)
+ **out = **in
+ }
+ if in.Description != nil {
+ in, out := &in.Description, &out.Description
+ *out = new(NeutronDescription)
+ **out = **in
+ }
+ if in.PortRef != nil {
+ in, out := &in.PortRef, &out.PortRef
+ *out = new(KubernetesNameRef)
+ **out = **in
+ }
+ if in.ProjectRef != nil {
+ in, out := &in.ProjectRef, &out.ProjectRef
+ *out = new(KubernetesNameRef)
+ **out = **in
+ }
+ if in.Status != nil {
+ in, out := &in.Status, &out.Status
+ *out = new(string)
+ **out = **in
+ }
+ if in.AdminStateUp != nil {
+ in, out := &in.AdminStateUp, &out.AdminStateUp
+ *out = new(bool)
+ **out = **in
+ }
+ in.FilterByNeutronTags.DeepCopyInto(&out.FilterByNeutronTags)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrunkFilter.
+func (in *TrunkFilter) DeepCopy() *TrunkFilter {
+ if in == nil {
+ return nil
+ }
+ out := new(TrunkFilter)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *TrunkImport) DeepCopyInto(out *TrunkImport) {
+ *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(TrunkFilter)
+ (*in).DeepCopyInto(*out)
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrunkImport.
+func (in *TrunkImport) DeepCopy() *TrunkImport {
+ if in == nil {
+ return nil
+ }
+ out := new(TrunkImport)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *TrunkList) DeepCopyInto(out *TrunkList) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ListMeta.DeepCopyInto(&out.ListMeta)
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]Trunk, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrunkList.
+func (in *TrunkList) DeepCopy() *TrunkList {
+ if in == nil {
+ return nil
+ }
+ out := new(TrunkList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *TrunkList) 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 *TrunkResourceSpec) DeepCopyInto(out *TrunkResourceSpec) {
+ *out = *in
+ if in.Name != nil {
+ in, out := &in.Name, &out.Name
+ *out = new(OpenStackName)
+ **out = **in
+ }
+ if in.Description != nil {
+ in, out := &in.Description, &out.Description
+ *out = new(NeutronDescription)
+ **out = **in
+ }
+ if in.ProjectRef != nil {
+ in, out := &in.ProjectRef, &out.ProjectRef
+ *out = new(KubernetesNameRef)
+ **out = **in
+ }
+ if in.AdminStateUp != nil {
+ in, out := &in.AdminStateUp, &out.AdminStateUp
+ *out = new(bool)
+ **out = **in
+ }
+ if in.Subports != nil {
+ in, out := &in.Subports, &out.Subports
+ *out = make([]TrunkSubportSpec, len(*in))
+ copy(*out, *in)
+ }
+ if in.Tags != nil {
+ in, out := &in.Tags, &out.Tags
+ *out = make([]NeutronTag, len(*in))
+ copy(*out, *in)
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrunkResourceSpec.
+func (in *TrunkResourceSpec) DeepCopy() *TrunkResourceSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(TrunkResourceSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *TrunkResourceStatus) DeepCopyInto(out *TrunkResourceStatus) {
+ *out = *in
+ if in.Tags != nil {
+ in, out := &in.Tags, &out.Tags
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
+ in.NeutronStatusMetadata.DeepCopyInto(&out.NeutronStatusMetadata)
+ if in.AdminStateUp != nil {
+ in, out := &in.AdminStateUp, &out.AdminStateUp
+ *out = new(bool)
+ **out = **in
+ }
+ if in.Subports != nil {
+ in, out := &in.Subports, &out.Subports
+ *out = make([]TrunkSubportStatus, len(*in))
+ copy(*out, *in)
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrunkResourceStatus.
+func (in *TrunkResourceStatus) DeepCopy() *TrunkResourceStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(TrunkResourceStatus)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *TrunkSpec) DeepCopyInto(out *TrunkSpec) {
+ *out = *in
+ if in.Import != nil {
+ in, out := &in.Import, &out.Import
+ *out = new(TrunkImport)
+ (*in).DeepCopyInto(*out)
+ }
+ if in.Resource != nil {
+ in, out := &in.Resource, &out.Resource
+ *out = new(TrunkResourceSpec)
+ (*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 TrunkSpec.
+func (in *TrunkSpec) DeepCopy() *TrunkSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(TrunkSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *TrunkStatus) DeepCopyInto(out *TrunkStatus) {
+ *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(TrunkResourceStatus)
+ (*in).DeepCopyInto(*out)
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrunkStatus.
+func (in *TrunkStatus) DeepCopy() *TrunkStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(TrunkStatus)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *TrunkSubportSpec) DeepCopyInto(out *TrunkSubportSpec) {
+ *out = *in
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrunkSubportSpec.
+func (in *TrunkSubportSpec) DeepCopy() *TrunkSubportSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(TrunkSubportSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *TrunkSubportStatus) DeepCopyInto(out *TrunkSubportStatus) {
+ *out = *in
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrunkSubportStatus.
+func (in *TrunkSubportStatus) DeepCopy() *TrunkSubportStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(TrunkSubportStatus)
+ in.DeepCopyInto(out)
+ return out
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UserDataSpec) DeepCopyInto(out *UserDataSpec) {
*out = *in
diff --git a/api/v1alpha1/zz_generated.trunk-resource.go b/api/v1alpha1/zz_generated.trunk-resource.go
new file mode 100644
index 00000000..c92b7e11
--- /dev/null
+++ b/api/v1alpha1/zz_generated.trunk-resource.go
@@ -0,0 +1,177 @@
+// Code generated by resource-generator. DO NOT EDIT.
+/*
+Copyright 2025 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"
+)
+
+// TrunkImport specifies an existing resource which will be imported instead of
+// creating a new one
+// +kubebuilder:validation:MinProperties:=1
+// +kubebuilder:validation:MaxProperties:=1
+type TrunkImport 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.
+ // +optional
+ // +kubebuilder:validation:Format:=uuid
+ ID *string `json:"id,omitempty"`
+
+ // 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 *TrunkFilter `json:"filter,omitempty"`
+}
+
+// TrunkSpec 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 TrunkSpec struct {
+ // import refers to an existing OpenStack resource which will be imported instead of
+ // creating a new one.
+ // +optional
+ Import *TrunkImport `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 *TrunkResourceSpec `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"`
+}
+
+// TrunkStatus defines the observed state of an ORC resource.
+type TrunkStatus 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.
+ // +optional
+ ID *string `json:"id,omitempty"`
+
+ // resource contains the observed state of the OpenStack resource.
+ // +optional
+ Resource *TrunkResourceStatus `json:"resource,omitempty"`
+}
+
+var _ ObjectWithConditions = &Trunk{}
+
+func (i *Trunk) 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"
+
+// Trunk is the Schema for an ORC resource.
+type Trunk struct {
+ metav1.TypeMeta `json:",inline"`
+
+ // metadata contains the object metadata
+ // +optional
+ metav1.ObjectMeta `json:"metadata,omitempty"`
+
+ // spec specifies the desired state of the resource.
+ // +optional
+ Spec TrunkSpec `json:"spec,omitempty"`
+
+ // status defines the observed state of the resource.
+ // +optional
+ Status TrunkStatus `json:"status,omitempty"`
+}
+
+// +kubebuilder:object:root=true
+
+// TrunkList contains a list of Trunk.
+type TrunkList struct {
+ metav1.TypeMeta `json:",inline"`
+
+ // metadata contains the list metadata
+ // +optional
+ metav1.ListMeta `json:"metadata,omitempty"`
+
+ // items contains a list of Trunk.
+ // +required
+ Items []Trunk `json:"items"`
+}
+
+func (l *TrunkList) GetItems() []Trunk {
+ return l.Items
+}
+
+func init() {
+ SchemeBuilder.Register(&Trunk{}, &TrunkList{})
+}
+
+func (i *Trunk) GetCloudCredentialsRef() (*string, *CloudCredentialsReference) {
+ if i == nil {
+ return nil, nil
+ }
+
+ return &i.Namespace, &i.Spec.CloudCredentialsRef
+}
+
+var _ CloudCredentialsRefProvider = &Trunk{}
diff --git a/cmd/manager/main.go b/cmd/manager/main.go
index 293aa2ba..bf9bc38c 100644
--- a/cmd/manager/main.go
+++ b/cmd/manager/main.go
@@ -45,6 +45,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/subnet"
+ "github.com/k-orc/openstack-resource-controller/v2/internal/controllers/trunk"
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/volume"
"github.com/k-orc/openstack-resource-controller/v2/internal/controllers/volumetype"
internalmanager "github.com/k-orc/openstack-resource-controller/v2/internal/manager"
@@ -113,6 +114,7 @@ func main() {
router.New(scopeFactory),
routerinterface.New(scopeFactory),
port.New(scopeFactory),
+ trunk.New(scopeFactory),
floatingip.New(scopeFactory),
flavor.New(scopeFactory),
securitygroup.New(scopeFactory),
diff --git a/cmd/models-schema/zz_generated.openapi.go b/cmd/models-schema/zz_generated.openapi.go
index 5b739dfe..e205e17f 100644
--- a/cmd/models-schema/zz_generated.openapi.go
+++ b/cmd/models-schema/zz_generated.openapi.go
@@ -199,6 +199,16 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
"github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.SubnetResourceStatus": schema_openstack_resource_controller_v2_api_v1alpha1_SubnetResourceStatus(ref),
"github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.SubnetSpec": schema_openstack_resource_controller_v2_api_v1alpha1_SubnetSpec(ref),
"github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.SubnetStatus": schema_openstack_resource_controller_v2_api_v1alpha1_SubnetStatus(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.Trunk": schema_openstack_resource_controller_v2_api_v1alpha1_Trunk(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkFilter": schema_openstack_resource_controller_v2_api_v1alpha1_TrunkFilter(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkImport": schema_openstack_resource_controller_v2_api_v1alpha1_TrunkImport(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkList": schema_openstack_resource_controller_v2_api_v1alpha1_TrunkList(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkResourceSpec": schema_openstack_resource_controller_v2_api_v1alpha1_TrunkResourceSpec(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkResourceStatus": schema_openstack_resource_controller_v2_api_v1alpha1_TrunkResourceStatus(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkSpec": schema_openstack_resource_controller_v2_api_v1alpha1_TrunkSpec(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkStatus": schema_openstack_resource_controller_v2_api_v1alpha1_TrunkStatus(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkSubportSpec": schema_openstack_resource_controller_v2_api_v1alpha1_TrunkSubportSpec(ref),
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkSubportStatus": schema_openstack_resource_controller_v2_api_v1alpha1_TrunkSubportStatus(ref),
"github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.UserDataSpec": schema_openstack_resource_controller_v2_api_v1alpha1_UserDataSpec(ref),
"github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.Volume": schema_openstack_resource_controller_v2_api_v1alpha1_Volume(ref),
"github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.VolumeAttachmentStatus": schema_openstack_resource_controller_v2_api_v1alpha1_VolumeAttachmentStatus(ref),
@@ -9590,6 +9600,654 @@ func schema_openstack_resource_controller_v2_api_v1alpha1_SubnetStatus(ref commo
}
}
+func schema_openstack_resource_controller_v2_api_v1alpha1_Trunk(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "Trunk 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.TrunkSpec"),
+ },
+ },
+ "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.TrunkStatus"),
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkSpec", "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_TrunkFilter(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "TrunkFilter 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: "",
+ },
+ },
+ "description": {
+ SchemaProps: spec.SchemaProps{
+ Description: "description of the existing resource",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "portRef": {
+ SchemaProps: spec.SchemaProps{
+ Description: "portRef is a reference to the ORC Port which this resource is associated with.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "projectRef": {
+ SchemaProps: spec.SchemaProps{
+ Description: "projectRef is a reference to the ORC Project which this resource is associated with.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "status": {
+ SchemaProps: spec.SchemaProps{
+ Description: "status indicates whether the trunk is currently operational. Possible values include `ACTIVE', `DOWN', `BUILD', `DEGRADED' or `ERROR'. Plug-ins might define additional values.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "adminStateUp": {
+ SchemaProps: spec.SchemaProps{
+ Description: "adminStateUp is the administrative state of the trunk.",
+ Type: []string{"boolean"},
+ Format: "",
+ },
+ },
+ "tags": {
+ VendorExtensible: spec.VendorExtensible{
+ Extensions: spec.Extensions{
+ "x-kubernetes-list-type": "set",
+ },
+ },
+ SchemaProps: spec.SchemaProps{
+ Description: "tags is a list of tags to filter by. If specified, the resource must have all of the tags specified to be included in the result.",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ },
+ },
+ },
+ "tagsAny": {
+ VendorExtensible: spec.VendorExtensible{
+ Extensions: spec.Extensions{
+ "x-kubernetes-list-type": "set",
+ },
+ },
+ SchemaProps: spec.SchemaProps{
+ Description: "tagsAny is a list of tags to filter by. If specified, the resource must have at least one of the tags specified to be included in the result.",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ },
+ },
+ },
+ "notTags": {
+ VendorExtensible: spec.VendorExtensible{
+ Extensions: spec.Extensions{
+ "x-kubernetes-list-type": "set",
+ },
+ },
+ SchemaProps: spec.SchemaProps{
+ Description: "notTags is a list of tags to filter by. If specified, resources which contain all of the given tags will be excluded from the result.",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ },
+ },
+ },
+ "notTagsAny": {
+ VendorExtensible: spec.VendorExtensible{
+ Extensions: spec.Extensions{
+ "x-kubernetes-list-type": "set",
+ },
+ },
+ SchemaProps: spec.SchemaProps{
+ Description: "notTagsAny is a list of tags to filter by. If specified, resources which contain any of the given tags will be excluded from the result.",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_TrunkImport(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "TrunkImport 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.TrunkFilter"),
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkFilter"},
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_TrunkList(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "TrunkList contains a list of Trunk.",
+ 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 Trunk.",
+ 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.Trunk"),
+ },
+ },
+ },
+ },
+ },
+ },
+ Required: []string{"items"},
+ },
+ },
+ Dependencies: []string{
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.Trunk", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_TrunkResourceSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "TrunkResourceSpec contains the desired state of the resource.",
+ 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: "",
+ },
+ },
+ "description": {
+ SchemaProps: spec.SchemaProps{
+ Description: "description is a human-readable description for the resource.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "portRef": {
+ SchemaProps: spec.SchemaProps{
+ Description: "portRef is a reference to the ORC Port which this resource is associated with.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "projectRef": {
+ SchemaProps: spec.SchemaProps{
+ Description: "projectRef is a reference to the ORC Project which this resource is associated with.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "adminStateUp": {
+ SchemaProps: spec.SchemaProps{
+ Description: "adminStateUp is the administrative state of the trunk. If false (down), the trunk does not forward packets.",
+ Type: []string{"boolean"},
+ Format: "",
+ },
+ },
+ "subports": {
+ VendorExtensible: spec.VendorExtensible{
+ Extensions: spec.Extensions{
+ "x-kubernetes-list-type": "atomic",
+ },
+ },
+ SchemaProps: spec.SchemaProps{
+ Description: "subports is the list of ports to attach to the trunk.\n\nNOTE: ORC currently does not implement reconcile logic for subport updates (Neutron uses dedicated add/remove subport APIs). This field is immutable until that behavior is implemented in the controller.",
+ 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.TrunkSubportSpec"),
+ },
+ },
+ },
+ },
+ },
+ "tags": {
+ VendorExtensible: spec.VendorExtensible{
+ Extensions: spec.Extensions{
+ "x-kubernetes-list-type": "set",
+ },
+ },
+ SchemaProps: spec.SchemaProps{
+ Description: "tags is a list of Neutron tags to apply to the trunk.\n\nNOTE: ORC does not currently reconcile tag updates for Trunk.",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ },
+ },
+ },
+ },
+ Required: []string{"portRef"},
+ },
+ },
+ Dependencies: []string{
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkSubportSpec"},
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_TrunkResourceStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "TrunkResourceStatus 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: "",
+ },
+ },
+ "description": {
+ SchemaProps: spec.SchemaProps{
+ Description: "description is a human-readable description for the resource.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "portID": {
+ SchemaProps: spec.SchemaProps{
+ Description: "portID is the ID of the Port to which the resource is associated.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "projectID": {
+ SchemaProps: spec.SchemaProps{
+ Description: "projectID is the ID of the Project to which the resource is associated.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "tenantID": {
+ SchemaProps: spec.SchemaProps{
+ Description: "tenantID is the project owner of the trunk (alias of projectID in some deployments).",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "status": {
+ SchemaProps: spec.SchemaProps{
+ Description: "status indicates whether the trunk is currently operational.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "tags": {
+ VendorExtensible: spec.VendorExtensible{
+ Extensions: spec.Extensions{
+ "x-kubernetes-list-type": "atomic",
+ },
+ },
+ SchemaProps: spec.SchemaProps{
+ Description: "tags is the list of tags on the resource.",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ },
+ },
+ },
+ "createdAt": {
+ SchemaProps: spec.SchemaProps{
+ Description: "createdAt shows the date and time when the resource was created. The date and time stamp format is ISO 8601",
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
+ },
+ },
+ "updatedAt": {
+ SchemaProps: spec.SchemaProps{
+ Description: "updatedAt shows the date and time when the resource was updated. The date and time stamp format is ISO 8601",
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
+ },
+ },
+ "revisionNumber": {
+ SchemaProps: spec.SchemaProps{
+ Description: "revisionNumber optionally set via extensions/standard-attr-revisions",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "adminStateUp": {
+ SchemaProps: spec.SchemaProps{
+ Description: "adminStateUp is the administrative state of the trunk.",
+ Type: []string{"boolean"},
+ Format: "",
+ },
+ },
+ "subports": {
+ VendorExtensible: spec.VendorExtensible{
+ Extensions: spec.Extensions{
+ "x-kubernetes-list-type": "atomic",
+ },
+ },
+ SchemaProps: spec.SchemaProps{
+ Description: "subports is a list of ports associated with the trunk.",
+ 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.TrunkSubportStatus"),
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkSubportStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_TrunkSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "TrunkSpec 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.TrunkImport"),
+ },
+ },
+ "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.TrunkResourceSpec"),
+ },
+ },
+ "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.TrunkImport", "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkResourceSpec"},
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_TrunkStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "TrunkStatus 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.TrunkResourceStatus"),
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1.TrunkResourceStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"},
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_TrunkSubportSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "TrunkSubportSpec represents a subport to attach to a trunk. It maps to gophercloud's trunks.Subport.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "portRef": {
+ SchemaProps: spec.SchemaProps{
+ Description: "portRef is a reference to the ORC Port that will be attached as a subport.",
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "segmentationID": {
+ SchemaProps: spec.SchemaProps{
+ Description: "segmentationID is the segmentation ID for the subport (e.g. VLAN ID).",
+ Default: 0,
+ Type: []string{"integer"},
+ Format: "int32",
+ },
+ },
+ "segmentationType": {
+ SchemaProps: spec.SchemaProps{
+ Description: "segmentationType is the segmentation type for the subport (e.g. vlan).",
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ },
+ Required: []string{"portRef", "segmentationID", "segmentationType"},
+ },
+ },
+ }
+}
+
+func schema_openstack_resource_controller_v2_api_v1alpha1_TrunkSubportStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "TrunkSubportStatus represents an attached subport on a trunk. It maps to gophercloud's trunks.Subport.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "portID": {
+ SchemaProps: spec.SchemaProps{
+ Description: "portID is the OpenStack ID of the Port attached as a subport.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "segmentationID": {
+ SchemaProps: spec.SchemaProps{
+ Description: "segmentationID is the segmentation ID for the subport (e.g. VLAN ID).",
+ Type: []string{"integer"},
+ Format: "int32",
+ },
+ },
+ "segmentationType": {
+ SchemaProps: spec.SchemaProps{
+ Description: "segmentationType is the segmentation type for the subport (e.g. vlan).",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
func schema_openstack_resource_controller_v2_api_v1alpha1_UserDataSpec(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 6848b155..6bbfa2cf 100644
--- a/cmd/resource-generator/main.go
+++ b/cmd/resource-generator/main.go
@@ -146,6 +146,9 @@ var resources []templateFields = []templateFields{
Name: "Subnet",
ExistingOSClient: true,
},
+ {
+ Name: "Trunk",
+ },
{
Name: "Volume",
},
diff --git a/config/crd/bases/openstack.k-orc.cloud_trunks.yaml b/config/crd/bases/openstack.k-orc.cloud_trunks.yaml
new file mode 100644
index 00000000..28cc0dbf
--- /dev/null
+++ b/config/crd/bases/openstack.k-orc.cloud_trunks.yaml
@@ -0,0 +1,518 @@
+---
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ annotations:
+ controller-gen.kubebuilder.io/version: v0.17.1
+ name: trunks.openstack.k-orc.cloud
+spec:
+ group: openstack.k-orc.cloud
+ names:
+ categories:
+ - openstack
+ kind: Trunk
+ listKind: TrunkList
+ plural: trunks
+ singular: trunk
+ 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: Trunk 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:
+ adminStateUp:
+ description: adminStateUp is the administrative state of the
+ trunk.
+ type: boolean
+ description:
+ description: description of the existing resource
+ maxLength: 255
+ minLength: 1
+ type: string
+ name:
+ description: name of the existing resource
+ maxLength: 255
+ minLength: 1
+ pattern: ^[^,]+$
+ type: string
+ notTags:
+ description: |-
+ notTags is a list of tags to filter by. If specified, resources which
+ contain all of the given tags will be excluded from the result.
+ items:
+ description: |-
+ NeutronTag represents a tag on a Neutron resource.
+ It may not be empty and may not contain commas.
+ maxLength: 255
+ minLength: 1
+ type: string
+ maxItems: 64
+ type: array
+ x-kubernetes-list-type: set
+ notTagsAny:
+ description: |-
+ notTagsAny is a list of tags to filter by. If specified, resources
+ which contain any of the given tags will be excluded from the result.
+ items:
+ description: |-
+ NeutronTag represents a tag on a Neutron resource.
+ It may not be empty and may not contain commas.
+ maxLength: 255
+ minLength: 1
+ type: string
+ maxItems: 64
+ type: array
+ x-kubernetes-list-type: set
+ portRef:
+ description: portRef is a reference to the ORC Port which
+ this resource is associated with.
+ maxLength: 253
+ minLength: 1
+ type: string
+ projectRef:
+ description: projectRef is a reference to the ORC Project
+ which this resource is associated with.
+ maxLength: 253
+ minLength: 1
+ type: string
+ status:
+ description: |-
+ status indicates whether the trunk is currently operational. Possible values include
+ `ACTIVE', `DOWN', `BUILD', `DEGRADED' or `ERROR'. Plug-ins might define additional values.
+ type: string
+ tags:
+ description: |-
+ tags is a list of tags to filter by. If specified, the resource must
+ have all of the tags specified to be included in the result.
+ items:
+ description: |-
+ NeutronTag represents a tag on a Neutron resource.
+ It may not be empty and may not contain commas.
+ maxLength: 255
+ minLength: 1
+ type: string
+ maxItems: 64
+ type: array
+ x-kubernetes-list-type: set
+ tagsAny:
+ description: |-
+ tagsAny is a list of tags to filter by. If specified, the resource
+ must have at least one of the tags specified to be included in the
+ result.
+ items:
+ description: |-
+ NeutronTag represents a tag on a Neutron resource.
+ It may not be empty and may not contain commas.
+ maxLength: 255
+ minLength: 1
+ type: string
+ maxItems: 64
+ type: array
+ x-kubernetes-list-type: set
+ 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
+ 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:
+ adminStateUp:
+ description: |-
+ adminStateUp is the administrative state of the trunk. If false (down),
+ the trunk does not forward packets.
+ type: boolean
+ description:
+ description: description is a human-readable description for the
+ resource.
+ maxLength: 255
+ minLength: 1
+ type: string
+ 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
+ portRef:
+ description: portRef is a reference to the ORC Port which this
+ resource is associated with.
+ maxLength: 253
+ minLength: 1
+ type: string
+ x-kubernetes-validations:
+ - message: portRef is immutable
+ rule: self == oldSelf
+ projectRef:
+ description: projectRef is a reference to the ORC Project which
+ this resource is associated with.
+ maxLength: 253
+ minLength: 1
+ type: string
+ x-kubernetes-validations:
+ - message: projectRef is immutable
+ rule: self == oldSelf
+ subports:
+ description: |-
+ subports is the list of ports to attach to the trunk.
+
+ NOTE: ORC currently does not implement reconcile logic for subport updates
+ (Neutron uses dedicated add/remove subport APIs). This field is immutable
+ until that behavior is implemented in the controller.
+ items:
+ description: |-
+ TrunkSubportSpec represents a subport to attach to a trunk.
+ It maps to gophercloud's trunks.Subport.
+ properties:
+ portRef:
+ description: portRef is a reference to the ORC Port that
+ will be attached as a subport.
+ maxLength: 253
+ minLength: 1
+ type: string
+ segmentationID:
+ description: segmentationID is the segmentation ID for the
+ subport (e.g. VLAN ID).
+ format: int32
+ maximum: 4094
+ minimum: 1
+ type: integer
+ segmentationType:
+ description: segmentationType is the segmentation type for
+ the subport (e.g. vlan).
+ maxLength: 255
+ minLength: 1
+ type: string
+ required:
+ - portRef
+ - segmentationID
+ - segmentationType
+ type: object
+ maxItems: 1024
+ type: array
+ x-kubernetes-list-type: atomic
+ x-kubernetes-validations:
+ - message: subports is immutable
+ rule: self == oldSelf
+ tags:
+ description: |-
+ tags is a list of Neutron tags to apply to the trunk.
+
+ NOTE: ORC does not currently reconcile tag updates for Trunk.
+ items:
+ description: |-
+ NeutronTag represents a tag on a Neutron resource.
+ It may not be empty and may not contain commas.
+ maxLength: 255
+ minLength: 1
+ type: string
+ maxItems: 64
+ type: array
+ x-kubernetes-list-type: set
+ x-kubernetes-validations:
+ - message: tags is immutable
+ rule: self == oldSelf
+ required:
+ - portRef
+ type: object
+ 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.
+ type: string
+ resource:
+ description: resource contains the observed state of the OpenStack
+ resource.
+ properties:
+ adminStateUp:
+ description: adminStateUp is the administrative state of the trunk.
+ type: boolean
+ createdAt:
+ description: createdAt shows the date and time when the resource
+ was created. The date and time stamp format is ISO 8601
+ format: date-time
+ type: string
+ description:
+ description: description is a human-readable description for the
+ resource.
+ maxLength: 1024
+ type: string
+ name:
+ description: name is a Human-readable name for the resource. Might
+ not be unique.
+ maxLength: 1024
+ type: string
+ portID:
+ description: portID is the ID of the Port to which the resource
+ is associated.
+ maxLength: 1024
+ type: string
+ projectID:
+ description: projectID is the ID of the Project to which the resource
+ is associated.
+ maxLength: 1024
+ type: string
+ revisionNumber:
+ description: revisionNumber optionally set via extensions/standard-attr-revisions
+ format: int64
+ type: integer
+ status:
+ description: status indicates whether the trunk is currently operational.
+ maxLength: 1024
+ type: string
+ subports:
+ description: subports is a list of ports associated with the trunk.
+ items:
+ description: |-
+ TrunkSubportStatus represents an attached subport on a trunk.
+ It maps to gophercloud's trunks.Subport.
+ properties:
+ portID:
+ description: portID is the OpenStack ID of the Port attached
+ as a subport.
+ maxLength: 1024
+ type: string
+ segmentationID:
+ description: segmentationID is the segmentation ID for the
+ subport (e.g. VLAN ID).
+ format: int32
+ type: integer
+ segmentationType:
+ description: segmentationType is the segmentation type for
+ the subport (e.g. vlan).
+ maxLength: 1024
+ type: string
+ type: object
+ maxItems: 1024
+ type: array
+ x-kubernetes-list-type: atomic
+ tags:
+ description: tags is the list of tags on the resource.
+ items:
+ maxLength: 1024
+ type: string
+ maxItems: 64
+ type: array
+ x-kubernetes-list-type: atomic
+ tenantID:
+ description: tenantID is the project owner of the trunk (alias
+ of projectID in some deployments).
+ maxLength: 1024
+ type: string
+ updatedAt:
+ description: updatedAt shows the date and time when the resource
+ was updated. The date and time stamp format is ISO 8601
+ format: date-time
+ type: string
+ type: object
+ type: object
+ type: object
+ served: true
+ storage: true
+ subresources:
+ status: {}
diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml
index 33b8c85e..b73dcac0 100644
--- a/config/crd/kustomization.yaml
+++ b/config/crd/kustomization.yaml
@@ -20,6 +20,7 @@ resources:
- bases/openstack.k-orc.cloud_servergroups.yaml
- bases/openstack.k-orc.cloud_services.yaml
- bases/openstack.k-orc.cloud_subnets.yaml
+- bases/openstack.k-orc.cloud_trunks.yaml
- bases/openstack.k-orc.cloud_volumes.yaml
- bases/openstack.k-orc.cloud_volumetypes.yaml
# +kubebuilder:scaffold:crdkustomizeresource
diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml
index 5a0a7443..5545c52a 100644
--- a/config/rbac/role.yaml
+++ b/config/rbac/role.yaml
@@ -34,6 +34,7 @@ rules:
- servers
- services
- subnets
+ - trunks
- volumes
- volumetypes
verbs:
@@ -64,6 +65,7 @@ rules:
- servers/status
- services/status
- subnets/status
+ - trunks/status
- volumes/status
- volumetypes/status
verbs:
diff --git a/config/samples/kustomization.yaml b/config/samples/kustomization.yaml
index dac467c6..aa2a75e4 100644
--- a/config/samples/kustomization.yaml
+++ b/config/samples/kustomization.yaml
@@ -18,6 +18,7 @@ resources:
- openstack_v1alpha1_servergroup.yaml
- openstack_v1alpha1_service.yaml
- openstack_v1alpha1_subnet.yaml
+- openstack_v1alpha1_trunk.yaml
- openstack_v1alpha1_volume.yaml
- openstack_v1alpha1_volumetype.yaml
# +kubebuilder:scaffold:manifestskustomizesamples
diff --git a/config/samples/openstack_v1alpha1_trunk.yaml b/config/samples/openstack_v1alpha1_trunk.yaml
new file mode 100644
index 00000000..7019315f
--- /dev/null
+++ b/config/samples/openstack_v1alpha1_trunk.yaml
@@ -0,0 +1,24 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-sample
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ description: Sample Trunk
+ name: trunk-sample-name
+ portRef: my-port
+ subPorts:
+ - portRef: sub-port-1
+ segmentationID: 101
+ segmentationType: vlan
+ - portRef: sub-port-2
+ segmentationID: 102
+ segmentationType: vlan
+ tags:
+ - tag1
+ - tag2
diff --git a/examples/components/kustomizeconfig/kustomizeconfig.yaml b/examples/components/kustomizeconfig/kustomizeconfig.yaml
index 90866d4e..c8439d33 100644
--- a/examples/components/kustomizeconfig/kustomizeconfig.yaml
+++ b/examples/components/kustomizeconfig/kustomizeconfig.yaml
@@ -25,6 +25,8 @@ nameReference:
kind: Subnet
- path: spec/cloudCredentialsRef/secretName
kind: KeyPair
+ - path: spec/cloudCredentialsRef/secretName
+ kind: Trunk
- kind: Network
fieldSpecs:
@@ -77,6 +79,12 @@ nameReference:
kind: FloatingIP
- path: spec/resource/ports[]/portRef
kind: Server
+ - path: spec/resource/portRef
+ kind: Trunk
+ - path: spec/resource/subports[]/portRef
+ kind: Trunk
+ - path: spec/import/filter/portRef
+ kind: Trunk
- kind: Project
fieldSpecs:
@@ -90,3 +98,7 @@ nameReference:
kind: Port
- path: spec/resource/projectRef
kind: SecurityGroup
+ - path: spec/resource/projectRef
+ kind: Trunk
+ - path: spec/import/filter/projectRef
+ kind: Trunk
diff --git a/internal/controllers/trunk/actuator.go b/internal/controllers/trunk/actuator.go
new file mode 100644
index 00000000..fa504afd
--- /dev/null
+++ b/internal/controllers/trunk/actuator.go
@@ -0,0 +1,318 @@
+/*
+Copyright 2025 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 trunk
+
+import (
+ "context"
+ "iter"
+ "fmt"
+
+ "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/trunks"
+ corev1 "k8s.io/api/core/v1"
+ apierrors "k8s.io/apimachinery/pkg/api/errors"
+ "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/logging"
+ "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 = trunks.Trunk
+
+ createResourceActuator = interfaces.CreateResourceActuator[orcObjectPT, orcObjectT, filterT, osResourceT]
+ deleteResourceActuator = interfaces.DeleteResourceActuator[orcObjectPT, orcObjectT, osResourceT]
+ resourceReconciler = interfaces.ResourceReconciler[orcObjectPT, osResourceT]
+ helperFactory = interfaces.ResourceHelperFactory[orcObjectPT, orcObjectT, resourceSpecT, filterT, osResourceT]
+)
+
+type trunkActuator struct {
+ osClient osclients.TrunkClient
+ k8sClient client.Client
+}
+
+var _ createResourceActuator = trunkActuator{}
+var _ deleteResourceActuator = trunkActuator{}
+
+func (trunkActuator) GetResourceID(osResource *osResourceT) string {
+ return osResource.ID
+}
+
+func (actuator trunkActuator) GetOSResourceByID(ctx context.Context, id string) (*osResourceT, progress.ReconcileStatus) {
+ resource, err := actuator.osClient.GetTrunk(ctx, id)
+ if err != nil {
+ return nil, progress.WrapError(err)
+ }
+ return resource, nil
+}
+
+func (actuator trunkActuator) ListOSResourcesForAdoption(ctx context.Context, orcObject orcObjectPT) (iter.Seq2[*osResourceT, error], bool) {
+ resourceSpec := orcObject.Spec.Resource
+ if resourceSpec == nil {
+ return nil, false
+ }
+
+ // TODO(scaffolding) If you need to filter resources on fields that the List() function
+ // of gophercloud does not support, it's possible to perform client-side filtering.
+ // Check osclients.ResourceFilter
+
+ listOpts := trunks.ListOpts{
+ Name: getResourceName(orcObject),
+ Description: ptr.Deref(resourceSpec.Description, ""),
+ }
+
+ return actuator.osClient.ListTrunks(ctx, listOpts), true
+}
+
+func (actuator trunkActuator) ListOSResourcesForImport(ctx context.Context, obj orcObjectPT, filter filterT) (iter.Seq2[*osResourceT, error], progress.ReconcileStatus) {
+ // TODO(scaffolding) If you need to filter resources on fields that the List() function
+ // of gophercloud does not support, it's possible to perform client-side filtering.
+ // Check osclients.ResourceFilter
+ var reconcileStatus progress.ReconcileStatus
+
+ port := &orcv1alpha1.Port{}
+ if filter.PortRef != nil {
+ portKey := client.ObjectKey{Name: string(*filter.PortRef), Namespace: obj.Namespace}
+ if err := actuator.k8sClient.Get(ctx, portKey, port); err != nil {
+ if apierrors.IsNotFound(err) {
+ reconcileStatus = reconcileStatus.WithReconcileStatus(
+ progress.WaitingOnObject("Port", portKey.Name, progress.WaitingOnCreation))
+ } else {
+ reconcileStatus = reconcileStatus.WithReconcileStatus(
+ progress.WrapError(fmt.Errorf("fetching port %s: %w", portKey.Name, err)))
+ }
+ } else {
+ if !orcv1alpha1.IsAvailable(port) || port.Status.ID == nil {
+ reconcileStatus = reconcileStatus.WithReconcileStatus(
+ progress.WaitingOnObject("Port", portKey.Name, progress.WaitingOnReady))
+ }
+ }
+ }
+
+ project := &orcv1alpha1.Project{}
+ if filter.ProjectRef != nil {
+ projectKey := client.ObjectKey{Name: string(*filter.ProjectRef), Namespace: obj.Namespace}
+ if err := actuator.k8sClient.Get(ctx, projectKey, project); err != nil {
+ if apierrors.IsNotFound(err) {
+ reconcileStatus = reconcileStatus.WithReconcileStatus(
+ progress.WaitingOnObject("Project", projectKey.Name, progress.WaitingOnCreation))
+ } else {
+ reconcileStatus = reconcileStatus.WithReconcileStatus(
+ progress.WrapError(fmt.Errorf("fetching project %s: %w", projectKey.Name, err)))
+ }
+ } else {
+ if !orcv1alpha1.IsAvailable(project) || project.Status.ID == nil {
+ reconcileStatus = reconcileStatus.WithReconcileStatus(
+ progress.WaitingOnObject("Project", projectKey.Name, progress.WaitingOnReady))
+ }
+ }
+ }
+
+ if needsReschedule, _ := reconcileStatus.NeedsReschedule(); needsReschedule {
+ return nil, reconcileStatus
+ }
+
+ listOpts := trunks.ListOpts{
+ Name: string(ptr.Deref(filter.Name, "")),
+ Description: string(ptr.Deref(filter.Description, "")),
+ PortID: ptr.Deref(port.Status.ID, ""),
+ ProjectID: ptr.Deref(project.Status.ID, ""),
+ // TODO(scaffolding): Add more import filters
+ }
+
+ return actuator.osClient.ListTrunks(ctx, listOpts), nil
+}
+
+func (actuator trunkActuator) 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"))
+ }
+ var reconcileStatus progress.ReconcileStatus
+
+ var portID string
+ port, portDepRS := portDependency.GetDependency(
+ ctx, actuator.k8sClient, obj, func(dep *orcv1alpha1.Port) bool {
+ return orcv1alpha1.IsAvailable(dep) && dep.Status.ID != nil
+ },
+ )
+ reconcileStatus = reconcileStatus.WithReconcileStatus(portDepRS)
+ if port != nil {
+ portID = ptr.Deref(port.Status.ID, "")
+ }
+
+ var projectID string
+ if resource.ProjectRef != nil {
+ project, projectDepRS := projectDependency.GetDependency(
+ ctx, actuator.k8sClient, obj, func(dep *orcv1alpha1.Project) bool {
+ return orcv1alpha1.IsAvailable(dep) && dep.Status.ID != nil
+ },
+ )
+ reconcileStatus = reconcileStatus.WithReconcileStatus(projectDepRS)
+ if project != nil {
+ projectID = ptr.Deref(project.Status.ID, "")
+ }
+ }
+ if needsReschedule, _ := reconcileStatus.NeedsReschedule(); needsReschedule {
+ return nil, reconcileStatus
+ }
+ createOpts := trunks.CreateOpts{
+ Name: getResourceName(obj),
+ Description: ptr.Deref(resource.Description, ""),
+ PortID: portID,
+ ProjectID: projectID,
+ // TODO(scaffolding): Add more fields
+ }
+
+ osResource, err := actuator.osClient.CreateTrunk(ctx, createOpts)
+ if err != nil {
+ // We should require the spec to be updated before retrying a create which returned a conflict
+ if !orcerrors.IsRetryable(err) {
+ err = orcerrors.Terminal(orcv1alpha1.ConditionReasonInvalidConfiguration, "invalid configuration creating resource: "+err.Error(), err)
+ }
+ return nil, progress.WrapError(err)
+ }
+
+ return osResource, nil
+}
+
+func (actuator trunkActuator) DeleteResource(ctx context.Context, _ orcObjectPT, resource *osResourceT) progress.ReconcileStatus {
+ return progress.WrapError(actuator.osClient.DeleteTrunk(ctx, resource.ID))
+}
+
+func (actuator trunkActuator) updateResource(ctx context.Context, obj orcObjectPT, osResource *osResourceT) progress.ReconcileStatus {
+ log := ctrl.LoggerFrom(ctx)
+ resource := obj.Spec.Resource
+ if resource == nil {
+ // Should have been caught by API validation
+ return progress.WrapError(
+ orcerrors.Terminal(orcv1alpha1.ConditionReasonInvalidConfiguration, "Update requested, but spec.resource is not set"))
+ }
+
+ updateOpts := trunks.UpdateOpts{}
+
+ handleNameUpdate(&updateOpts, obj, osResource)
+ handleDescriptionUpdate(&updateOpts, resource, osResource)
+
+ // TODO(scaffolding): add handler for all fields supporting mutability
+
+ needsUpdate, err := needsUpdate(updateOpts)
+ if err != nil {
+ return progress.WrapError(
+ orcerrors.Terminal(orcv1alpha1.ConditionReasonInvalidConfiguration, "invalid configuration updating resource: "+err.Error(), err))
+ }
+ if !needsUpdate {
+ log.V(logging.Debug).Info("No changes")
+ return nil
+ }
+
+ _, err = actuator.osClient.UpdateTrunk(ctx, osResource.ID, updateOpts)
+
+ // We should require the spec to be updated before retrying an update which returned a conflict
+ if orcerrors.IsConflict(err) {
+ err = orcerrors.Terminal(orcv1alpha1.ConditionReasonInvalidConfiguration, "invalid configuration updating resource: "+err.Error(), err)
+ }
+
+ if err != nil {
+ return progress.WrapError(err)
+ }
+
+ return progress.NeedsRefresh()
+}
+
+func needsUpdate(updateOpts trunks.UpdateOpts) (bool, error) {
+ updateOptsMap, err := updateOpts.ToTrunkUpdateMap()
+ if err != nil {
+ return false, err
+ }
+
+ updateMap, ok := updateOptsMap["trunk"].(map[string]any)
+ if !ok {
+ updateMap = make(map[string]any)
+ }
+
+ return len(updateMap) > 0, nil
+}
+
+func handleNameUpdate(updateOpts *trunks.UpdateOpts, obj orcObjectPT, osResource *osResourceT) {
+ name := getResourceName(obj)
+ if osResource.Name != name {
+ updateOpts.Name = &name
+ }
+}
+
+func handleDescriptionUpdate(updateOpts *trunks.UpdateOpts, resource *resourceSpecT, osResource *osResourceT) {
+ description := ptr.Deref(resource.Description, "")
+ if osResource.Description != description {
+ updateOpts.Description = &description
+ }
+}
+
+func (actuator trunkActuator) GetResourceReconcilers(ctx context.Context, orcObject orcObjectPT, osResource *osResourceT, controller interfaces.ResourceController) ([]resourceReconciler, progress.ReconcileStatus) {
+ return []resourceReconciler{
+ actuator.updateResource,
+ }, nil
+}
+
+type trunkHelperFactory struct{}
+
+var _ helperFactory = trunkHelperFactory{}
+
+func newActuator(ctx context.Context, orcObject *orcv1alpha1.Trunk, controller interfaces.ResourceController) (trunkActuator, 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 trunkActuator{}, reconcileStatus
+ }
+
+ clientScope, err := controller.GetScopeFactory().NewClientScopeFromObject(ctx, controller.GetK8sClient(), log, orcObject)
+ if err != nil {
+ return trunkActuator{}, progress.WrapError(err)
+ }
+ osClient, err := clientScope.NewTrunkClient()
+ if err != nil {
+ return trunkActuator{}, progress.WrapError(err)
+ }
+
+ return trunkActuator{
+ osClient: osClient,
+ k8sClient: controller.GetK8sClient(),
+ }, nil
+}
+
+func (trunkHelperFactory) NewAPIObjectAdapter(obj orcObjectPT) adapterI {
+ return trunkAdapter{obj}
+}
+
+func (trunkHelperFactory) NewCreateActuator(ctx context.Context, orcObject orcObjectPT, controller interfaces.ResourceController) (createResourceActuator, progress.ReconcileStatus) {
+ return newActuator(ctx, orcObject, controller)
+}
+
+func (trunkHelperFactory) NewDeleteActuator(ctx context.Context, orcObject orcObjectPT, controller interfaces.ResourceController) (deleteResourceActuator, progress.ReconcileStatus) {
+ return newActuator(ctx, orcObject, controller)
+}
diff --git a/internal/controllers/trunk/actuator_test.go b/internal/controllers/trunk/actuator_test.go
new file mode 100644
index 00000000..8bc6a707
--- /dev/null
+++ b/internal/controllers/trunk/actuator_test.go
@@ -0,0 +1,119 @@
+/*
+Copyright 2025 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 trunk
+
+import (
+ "testing"
+
+ "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/trunks"
+ orcv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
+ "k8s.io/utils/ptr"
+)
+
+func TestNeedsUpdate(t *testing.T) {
+ testCases := []struct {
+ name string
+ updateOpts trunks.UpdateOpts
+ expectChange bool
+ }{
+ {
+ name: "Empty base opts",
+ updateOpts: trunks.UpdateOpts{},
+ expectChange: false,
+ },
+ {
+ name: "Updated opts",
+ updateOpts: trunks.UpdateOpts{Name: ptr.To("updated")},
+ expectChange: true,
+ },
+ }
+
+ for _, tt := range testCases {
+ t.Run(tt.name, func(t *testing.T) {
+ got, _ := needsUpdate(tt.updateOpts)
+ if got != tt.expectChange {
+ t.Errorf("Expected change: %v, got: %v", tt.expectChange, got)
+ }
+ })
+ }
+}
+
+func TestHandleNameUpdate(t *testing.T) {
+ ptrToName := ptr.To[orcv1alpha1.OpenStackName]
+ testCases := []struct {
+ name string
+ newValue *orcv1alpha1.OpenStackName
+ existingValue string
+ expectChange bool
+ }{
+ {name: "Identical", newValue: ptrToName("name"), existingValue: "name", expectChange: false},
+ {name: "Different", newValue: ptrToName("new-name"), existingValue: "name", expectChange: true},
+ {name: "No value provided, existing is identical to object name", newValue: nil, existingValue: "object-name", expectChange: false},
+ {name: "No value provided, existing is different from object name", newValue: nil, existingValue: "different-from-object-name", expectChange: true},
+ }
+
+ for _, tt := range testCases {
+ t.Run(tt.name, func(t *testing.T) {
+ resource := &orcv1alpha1.Trunk{}
+ resource.Name = "object-name"
+ resource.Spec = orcv1alpha1.TrunkSpec{
+ Resource: &orcv1alpha1.TrunkResourceSpec{Name: tt.newValue},
+ }
+ osResource := &osResourceT{Name: tt.existingValue}
+
+ updateOpts := trunks.UpdateOpts{}
+ handleNameUpdate(&updateOpts, resource, osResource)
+
+ got, _ := needsUpdate(updateOpts)
+ if got != tt.expectChange {
+ t.Errorf("Expected change: %v, got: %v", tt.expectChange, got)
+ }
+ })
+
+ }
+}
+
+func TestHandleDescriptionUpdate(t *testing.T) {
+ ptrToDescription := ptr.To[string]
+ testCases := []struct {
+ name string
+ newValue *string
+ existingValue string
+ expectChange bool
+ }{
+ {name: "Identical", newValue: ptrToDescription("desc"), existingValue: "desc", expectChange: false},
+ {name: "Different", newValue: ptrToDescription("new-desc"), existingValue: "desc", expectChange: true},
+ {name: "No value provided, existing is set", newValue: nil, existingValue: "desc", expectChange: true},
+ {name: "No value provided, existing is empty", newValue: nil, existingValue: "", expectChange: false},
+ }
+
+ for _, tt := range testCases {
+ t.Run(tt.name, func(t *testing.T) {
+ resource := &orcv1alpha1.TrunkResourceSpec{Description: tt.newValue}
+ osResource := &osResourceT{Description: tt.existingValue}
+
+ updateOpts := trunks.UpdateOpts{}
+ handleDescriptionUpdate(&updateOpts, resource, osResource)
+
+ got, _ := needsUpdate(updateOpts)
+ if got != tt.expectChange {
+ t.Errorf("Expected change: %v, got: %v", tt.expectChange, got)
+ }
+ })
+
+ }
+}
diff --git a/internal/controllers/trunk/controller.go b/internal/controllers/trunk/controller.go
new file mode 100644
index 00000000..79efb943
--- /dev/null
+++ b/internal/controllers/trunk/controller.go
@@ -0,0 +1,156 @@
+/*
+Copyright 2025 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 trunk
+
+import (
+ "context"
+ "errors"
+
+ ctrl "sigs.k8s.io/controller-runtime"
+ "sigs.k8s.io/controller-runtime/pkg/builder"
+ "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"
+ "github.com/k-orc/openstack-resource-controller/v2/internal/util/dependency"
+ "github.com/k-orc/openstack-resource-controller/v2/pkg/predicates"
+)
+
+const controllerName = "trunk"
+
+// +kubebuilder:rbac:groups=openstack.k-orc.cloud,resources=trunks,verbs=get;list;watch;create;update;patch;delete
+// +kubebuilder:rbac:groups=openstack.k-orc.cloud,resources=trunks/status,verbs=get;update;patch
+
+type trunkReconcilerConstructor struct {
+ scopeFactory scope.Factory
+}
+
+func New(scopeFactory scope.Factory) interfaces.Controller {
+ return trunkReconcilerConstructor{scopeFactory: scopeFactory}
+}
+
+func (trunkReconcilerConstructor) GetName() string {
+ return controllerName
+}
+
+var portDependency = dependency.NewDeletionGuardDependency[*orcv1alpha1.TrunkList, *orcv1alpha1.Port](
+ "spec.resource.portRef",
+ func(trunk *orcv1alpha1.Trunk) []string {
+ resource := trunk.Spec.Resource
+ if resource == nil {
+ return nil
+ }
+ return []string{string(resource.PortRef)}
+ },
+ finalizer, externalObjectFieldOwner,
+)
+
+var projectDependency = dependency.NewDeletionGuardDependency[*orcv1alpha1.TrunkList, *orcv1alpha1.Project](
+ "spec.resource.projectRef",
+ func(trunk *orcv1alpha1.Trunk) []string {
+ resource := trunk.Spec.Resource
+ if resource == nil || resource.ProjectRef == nil {
+ return nil
+ }
+ return []string{string(*resource.ProjectRef)}
+ },
+ finalizer, externalObjectFieldOwner,
+)
+
+var portImportDependency = dependency.NewDependency[*orcv1alpha1.TrunkList, *orcv1alpha1.Port](
+ "spec.import.filter.portRef",
+ func(trunk *orcv1alpha1.Trunk) []string {
+ resource := trunk.Spec.Import
+ if resource == nil || resource.Filter == nil || resource.Filter.PortRef == nil {
+ return nil
+ }
+ return []string{string(*resource.Filter.PortRef)}
+ },
+)
+
+var projectImportDependency = dependency.NewDependency[*orcv1alpha1.TrunkList, *orcv1alpha1.Project](
+ "spec.import.filter.projectRef",
+ func(trunk *orcv1alpha1.Trunk) []string {
+ resource := trunk.Spec.Import
+ if resource == nil || resource.Filter == nil || resource.Filter.ProjectRef == nil {
+ return nil
+ }
+ return []string{string(*resource.Filter.ProjectRef)}
+ },
+)
+
+// SetupWithManager sets up the controller with the Manager.
+func (c trunkReconcilerConstructor) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
+ log := ctrl.LoggerFrom(ctx)
+ k8sClient := mgr.GetClient()
+
+ portWatchEventHandler, err := portDependency.WatchEventHandler(log, k8sClient)
+ if err != nil {
+ return err
+ }
+
+ projectWatchEventHandler, err := projectDependency.WatchEventHandler(log, k8sClient)
+ if err != nil {
+ return err
+ }
+
+ portImportWatchEventHandler, err := portImportDependency.WatchEventHandler(log, k8sClient)
+ if err != nil {
+ return err
+ }
+
+ projectImportWatchEventHandler, err := projectImportDependency.WatchEventHandler(log, k8sClient)
+ if err != nil {
+ return err
+ }
+
+ builder := ctrl.NewControllerManagedBy(mgr).
+ WithOptions(options).
+ Watches(&orcv1alpha1.Port{}, portWatchEventHandler,
+ builder.WithPredicates(predicates.NewBecameAvailable(log, &orcv1alpha1.Port{})),
+ ).
+ Watches(&orcv1alpha1.Project{}, projectWatchEventHandler,
+ builder.WithPredicates(predicates.NewBecameAvailable(log, &orcv1alpha1.Project{})),
+ ).
+ // A second watch is necessary because we need a different handler that omits deletion guards
+ Watches(&orcv1alpha1.Port{}, portImportWatchEventHandler,
+ builder.WithPredicates(predicates.NewBecameAvailable(log, &orcv1alpha1.Port{})),
+ ).
+ // A second watch is necessary because we need a different handler that omits deletion guards
+ Watches(&orcv1alpha1.Project{}, projectImportWatchEventHandler,
+ builder.WithPredicates(predicates.NewBecameAvailable(log, &orcv1alpha1.Project{})),
+ ).
+ For(&orcv1alpha1.Trunk{})
+
+ if err := errors.Join(
+ portDependency.AddToManager(ctx, mgr),
+ projectDependency.AddToManager(ctx, mgr),
+ portImportDependency.AddToManager(ctx, mgr),
+ projectImportDependency.AddToManager(ctx, mgr),
+ credentialsDependency.AddToManager(ctx, mgr),
+ credentials.AddCredentialsWatch(log, mgr.GetClient(), builder, credentialsDependency),
+ ); err != nil {
+ return err
+ }
+
+ r := reconciler.NewController(controllerName, mgr.GetClient(), c.scopeFactory, trunkHelperFactory{}, trunkStatusWriter{})
+ return builder.Complete(&r)
+}
diff --git a/internal/controllers/trunk/status.go b/internal/controllers/trunk/status.go
new file mode 100644
index 00000000..3ca73cd5
--- /dev/null
+++ b/internal/controllers/trunk/status.go
@@ -0,0 +1,70 @@
+/*
+Copyright 2025 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 trunk
+
+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 trunkStatusWriter struct{}
+
+type objectApplyT = orcapplyconfigv1alpha1.TrunkApplyConfiguration
+type statusApplyT = orcapplyconfigv1alpha1.TrunkStatusApplyConfiguration
+
+var _ interfaces.ResourceStatusWriter[*orcv1alpha1.Trunk, *osResourceT, *objectApplyT, *statusApplyT] = trunkStatusWriter{}
+
+func (trunkStatusWriter) GetApplyConfig(name, namespace string) *objectApplyT {
+ return orcapplyconfigv1alpha1.Trunk(name, namespace)
+}
+
+func (trunkStatusWriter) ResourceAvailableStatus(orcObject *orcv1alpha1.Trunk, 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 (trunkStatusWriter) ApplyResourceStatus(log logr.Logger, osResource *osResourceT, statusApply *statusApplyT) {
+ resourceStatus := orcapplyconfigv1alpha1.TrunkResourceStatus().
+ WithPortID(osResource.PortID).
+ WithProjectID(osResource.ProjectID).
+ WithName(osResource.Name)
+
+ if len(osResource.Tags) > 0 {
+ resourceStatus.WithTags(osResource.Tags...)
+ }
+
+ if len(osResource.Subports) > 0 {
+ resourceStatus.WithSubports(osResource.Subports...)
+ }
+
+ if osResource.Description != "" {
+ resourceStatus.WithDescription(osResource.Description)
+ }
+
+ statusApply.WithResource(resourceStatus)
+}
diff --git a/internal/controllers/trunk/tests/trunk-create-full/00-assert.yaml b/internal/controllers/trunk/tests/trunk-create-full/00-assert.yaml
new file mode 100644
index 00000000..8a61e25f
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-create-full/00-assert.yaml
@@ -0,0 +1,31 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-create-full
+status:
+ resource:
+ name: trunk-create-full-override
+ description: Trunk from "create full" test
+ 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: Trunk
+ name: trunk-create-full
+ ref: trunk
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Port
+ name: trunk-create-full
+ ref: port
+assertAll:
+ - celExpr: "trunk.status.id != ''"
+ - celExpr: "trunk.status.resource.portID == port.status.id"
diff --git a/internal/controllers/trunk/tests/trunk-create-full/00-create-resource.yaml b/internal/controllers/trunk/tests/trunk-create-full/00-create-resource.yaml
new file mode 100644
index 00000000..7019c1c4
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-create-full/00-create-resource.yaml
@@ -0,0 +1,54 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Network
+metadata:
+ name: trunk-create-full
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ name: trunk-create-full
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Subnet
+metadata:
+ name: trunk-create-full
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-create-full
+ ipVersion: 4
+ cidr: 192.168.158.0/24
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-create-full
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-create-full
+ addresses:
+ - subnetRef: trunk-create-full
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-create-full
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ name: trunk-create-full-override
+ description: Trunk from "create full" test
+ portRef: trunk-create-full
diff --git a/internal/controllers/trunk/tests/trunk-create-full/00-secret.yaml b/internal/controllers/trunk/tests/trunk-create-full/00-secret.yaml
new file mode 100644
index 00000000..045711ee
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-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/trunk/tests/trunk-create-full/README.md b/internal/controllers/trunk/tests/trunk-create-full/README.md
new file mode 100644
index 00000000..45eabc56
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-create-full/README.md
@@ -0,0 +1,11 @@
+# Create a Trunk with all the options
+
+## Step 00
+
+Create a Trunk using all available fields, and verify that the observed state corresponds to the spec.
+
+Also validate that the OpenStack resource uses the name from the spec when it is specified.
+
+## Reference
+
+https://k-orc.cloud/development/writing-tests/#create-full
diff --git a/internal/controllers/trunk/tests/trunk-create-minimal/00-assert.yaml b/internal/controllers/trunk/tests/trunk-create-minimal/00-assert.yaml
new file mode 100644
index 00000000..8a036797
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-create-minimal/00-assert.yaml
@@ -0,0 +1,30 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-create-minimal
+status:
+ resource:
+ name: trunk-create-minimal
+ 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: Trunk
+ name: trunk-create-minimal
+ ref: trunk
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Port
+ name: trunk-create-minimal
+ ref: port
+assertAll:
+ - celExpr: "trunk.status.id != ''"
+ - celExpr: "trunk.status.resource.portID == port.status.id"
diff --git a/internal/controllers/trunk/tests/trunk-create-minimal/00-create-resource.yaml b/internal/controllers/trunk/tests/trunk-create-minimal/00-create-resource.yaml
new file mode 100644
index 00000000..4e665ef5
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-create-minimal/00-create-resource.yaml
@@ -0,0 +1,12 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-create-minimal
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ portRef: trunk-create-minimal
diff --git a/internal/controllers/trunk/tests/trunk-create-minimal/00-prerequisites.yaml b/internal/controllers/trunk/tests/trunk-create-minimal/00-prerequisites.yaml
new file mode 100644
index 00000000..f8ada774
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-create-minimal/00-prerequisites.yaml
@@ -0,0 +1,46 @@
+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
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Network
+metadata:
+ name: trunk-create-minimal
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ name: trunk-create-minimal
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Subnet
+metadata:
+ name: trunk-create-minimal
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-create-minimal
+ ipVersion: 4
+ cidr: 192.168.156.0/24
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-create-minimal
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-create-minimal
+ addresses:
+ - subnetRef: trunk-create-minimal
+
diff --git a/internal/controllers/trunk/tests/trunk-create-minimal/01-assert.yaml b/internal/controllers/trunk/tests/trunk-create-minimal/01-assert.yaml
new file mode 100644
index 00000000..35eab2ad
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-create-minimal/01-assert.yaml
@@ -0,0 +1,11 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+resourceRefs:
+ - apiVersion: v1
+ kind: Secret
+ name: openstack-clouds
+ ref: secret
+assertAll:
+ - celExpr: "secret.metadata.deletionTimestamp != 0"
+ - celExpr: "'openstack.k-orc.cloud/trunk' in secret.metadata.finalizers"
diff --git a/internal/controllers/trunk/tests/trunk-create-minimal/01-delete-secret.yaml b/internal/controllers/trunk/tests/trunk-create-minimal/01-delete-secret.yaml
new file mode 100644
index 00000000..1620791b
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-create-minimal/01-delete-secret.yaml
@@ -0,0 +1,7 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestStep
+commands:
+ # We expect the deletion to hang due to the finalizer, so use --wait=false
+ - command: kubectl delete secret openstack-clouds --wait=false
+ namespaced: true
diff --git a/internal/controllers/trunk/tests/trunk-create-minimal/README.md b/internal/controllers/trunk/tests/trunk-create-minimal/README.md
new file mode 100644
index 00000000..49a8df75
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-create-minimal/README.md
@@ -0,0 +1,15 @@
+# Create a Trunk with the minimum options
+
+## Step 00
+
+Create a minimal Trunk, that sets only the required fields, and verify that the observed state corresponds to the spec.
+
+Also validate that the OpenStack resource uses the name of the ORC object when no name is explicitly specified.
+
+## Step 01
+
+Try deleting the secret and ensure that it is not deleted thanks to the finalizer.
+
+## Reference
+
+https://k-orc.cloud/development/writing-tests/#create-minimal
diff --git a/internal/controllers/trunk/tests/trunk-dependency/00-assert.yaml b/internal/controllers/trunk/tests/trunk-dependency/00-assert.yaml
new file mode 100644
index 00000000..b5b6be24
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-dependency/00-assert.yaml
@@ -0,0 +1,45 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-dependency-no-secret
+status:
+ conditions:
+ - type: Available
+ message: Waiting for Secret/trunk-dependency to be created
+ status: "False"
+ reason: Progressing
+ - type: Progressing
+ message: Waiting for Secret/trunk-dependency to be created
+ status: "True"
+ reason: Progressing
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-dependency-no-port
+status:
+ conditions:
+ - type: Available
+ message: Waiting for Port/trunk-dependency-pending to be created
+ status: "False"
+ reason: Progressing
+ - type: Progressing
+ message: Waiting for Port/trunk-dependency-pending to be created
+ status: "True"
+ reason: Progressing
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-dependency-no-project
+status:
+ conditions:
+ - type: Available
+ message: Waiting for Project/trunk-dependency to be created
+ status: "False"
+ reason: Progressing
+ - type: Progressing
+ message: Waiting for Project/trunk-dependency to be created
+ status: "True"
+ reason: Progressing
diff --git a/internal/controllers/trunk/tests/trunk-dependency/00-create-resources-missing-deps.yaml b/internal/controllers/trunk/tests/trunk-dependency/00-create-resources-missing-deps.yaml
new file mode 100644
index 00000000..9ecc8c4f
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-dependency/00-create-resources-missing-deps.yaml
@@ -0,0 +1,91 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Network
+metadata:
+ name: trunk-dependency
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ name: trunk-dependency
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Subnet
+metadata:
+ name: trunk-dependency
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ cidr: 192.168.160.0/24
+ ipVersion: 4
+ networkRef: trunk-dependency
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-dependency
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-dependency
+ addresses:
+ - subnetRef: trunk-dependency
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-dependency-no-secret
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-dependency
+ addresses:
+ - subnetRef: trunk-dependency
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-dependency-no-port
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ portRef: trunk-dependency-pending
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-dependency-no-project
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ portRef: trunk-dependency
+ projectRef: trunk-dependency
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-dependency-no-secret
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: trunk-dependency
+ managementPolicy: managed
+ resource:
+ portRef: trunk-dependency-no-secret
diff --git a/internal/controllers/trunk/tests/trunk-dependency/00-secret.yaml b/internal/controllers/trunk/tests/trunk-dependency/00-secret.yaml
new file mode 100644
index 00000000..045711ee
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-dependency/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/trunk/tests/trunk-dependency/01-assert.yaml b/internal/controllers/trunk/tests/trunk-dependency/01-assert.yaml
new file mode 100644
index 00000000..c2a36dd0
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-dependency/01-assert.yaml
@@ -0,0 +1,45 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-dependency-no-secret
+status:
+ conditions:
+ - type: Available
+ message: OpenStack resource is available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ message: OpenStack resource is up to date
+ status: "False"
+ reason: Success
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-dependency-no-port
+status:
+ conditions:
+ - type: Available
+ message: OpenStack resource is available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ message: OpenStack resource is up to date
+ status: "False"
+ reason: Success
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-dependency-no-project
+status:
+ conditions:
+ - type: Available
+ message: OpenStack resource is available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ message: OpenStack resource is up to date
+ status: "False"
+ reason: Success
diff --git a/internal/controllers/trunk/tests/trunk-dependency/01-create-dependencies.yaml b/internal/controllers/trunk/tests/trunk-dependency/01-create-dependencies.yaml
new file mode 100644
index 00000000..4df21bd8
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-dependency/01-create-dependencies.yaml
@@ -0,0 +1,32 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestStep
+commands:
+ - command: kubectl create secret generic trunk-dependency --from-file=clouds.yaml=${E2E_KUTTL_OSCLOUDS} ${E2E_KUTTL_CACERT_OPT}
+ namespaced: true
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-dependency-pending
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-dependency
+ addresses:
+ - subnetRef: trunk-dependency
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Project
+metadata:
+ name: trunk-dependency
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ name: trunk-dependency
diff --git a/internal/controllers/trunk/tests/trunk-dependency/02-assert.yaml b/internal/controllers/trunk/tests/trunk-dependency/02-assert.yaml
new file mode 100644
index 00000000..7a14ca79
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-dependency/02-assert.yaml
@@ -0,0 +1,23 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+resourceRefs:
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Port
+ name: trunk-dependency
+ ref: port
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Project
+ name: trunk-dependency
+ ref: project
+ - apiVersion: v1
+ kind: Secret
+ name: trunk-dependency
+ ref: secret
+assertAll:
+ - celExpr: "port.metadata.deletionTimestamp != 0"
+ - celExpr: "'openstack.k-orc.cloud/trunk' in port.metadata.finalizers"
+ - celExpr: "project.metadata.deletionTimestamp != 0"
+ - celExpr: "'openstack.k-orc.cloud/trunk' in project.metadata.finalizers"
+ - celExpr: "secret.metadata.deletionTimestamp != 0"
+ - celExpr: "'openstack.k-orc.cloud/trunk' in secret.metadata.finalizers"
diff --git a/internal/controllers/trunk/tests/trunk-dependency/02-delete-dependencies.yaml b/internal/controllers/trunk/tests/trunk-dependency/02-delete-dependencies.yaml
new file mode 100644
index 00000000..caae7003
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-dependency/02-delete-dependencies.yaml
@@ -0,0 +1,11 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestStep
+commands:
+ # We expect the deletion to hang due to the finalizer, so use --wait=false
+ - command: kubectl delete port trunk-dependency --wait=false
+ namespaced: true
+ - command: kubectl delete project trunk-dependency --wait=false
+ namespaced: true
+ - command: kubectl delete secret trunk-dependency --wait=false
+ namespaced: true
diff --git a/internal/controllers/trunk/tests/trunk-dependency/03-assert.yaml b/internal/controllers/trunk/tests/trunk-dependency/03-assert.yaml
new file mode 100644
index 00000000..066b783c
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-dependency/03-assert.yaml
@@ -0,0 +1,11 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+commands:
+# Dependencies that were prevented deletion before should now be gone
+- script: "! kubectl get port trunk-dependency --namespace $NAMESPACE"
+ skipLogOutput: true
+- script: "! kubectl get project trunk-dependency --namespace $NAMESPACE"
+ skipLogOutput: true
+- script: "! kubectl get secret trunk-dependency --namespace $NAMESPACE"
+ skipLogOutput: true
diff --git a/internal/controllers/trunk/tests/trunk-dependency/03-delete-resources.yaml b/internal/controllers/trunk/tests/trunk-dependency/03-delete-resources.yaml
new file mode 100644
index 00000000..25f2a80c
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-dependency/03-delete-resources.yaml
@@ -0,0 +1,13 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestStep
+delete:
+- apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Trunk
+ name: trunk-dependency-no-secret
+- apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Trunk
+ name: trunk-dependency-no-port
+- apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Trunk
+ name: trunk-dependency-no-project
diff --git a/internal/controllers/trunk/tests/trunk-dependency/README.md b/internal/controllers/trunk/tests/trunk-dependency/README.md
new file mode 100644
index 00000000..14d0a8ec
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-dependency/README.md
@@ -0,0 +1,21 @@
+# Creation and deletion dependencies
+
+## Step 00
+
+Create Trunks referencing non-existing resources. Each Trunk is dependent on other non-existing resource. Verify that the Trunks are waiting for the needed resources to be created externally.
+
+## Step 01
+
+Create the missing dependencies and verify all the Trunks are available.
+
+## Step 02
+
+Delete all the dependencies and check that ORC prevents deletion since there is still a resource that depends on them.
+
+## Step 03
+
+Delete the Trunks and validate that all resources are gone.
+
+## Reference
+
+https://k-orc.cloud/development/writing-tests/#dependency
diff --git a/internal/controllers/trunk/tests/trunk-import-dependency/00-assert.yaml b/internal/controllers/trunk/tests/trunk-import-dependency/00-assert.yaml
new file mode 100644
index 00000000..f6904cc7
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-dependency/00-assert.yaml
@@ -0,0 +1,19 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-dependency
+status:
+ conditions:
+ - type: Available
+ message: |-
+ Waiting for Port/trunk-import-dependency to be ready
+ Waiting for Project/trunk-import-dependency to be ready
+ status: "False"
+ reason: Progressing
+ - type: Progressing
+ message: |-
+ Waiting for Port/trunk-import-dependency to be ready
+ Waiting for Project/trunk-import-dependency to be ready
+ status: "True"
+ reason: Progressing
diff --git a/internal/controllers/trunk/tests/trunk-import-dependency/00-import-resource.yaml b/internal/controllers/trunk/tests/trunk-import-dependency/00-import-resource.yaml
new file mode 100644
index 00000000..2cf348d3
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-dependency/00-import-resource.yaml
@@ -0,0 +1,40 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-import-dependency
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: unmanaged
+ import:
+ filter:
+ name: trunk-import-dependency-external
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Project
+metadata:
+ name: trunk-import-dependency
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: unmanaged
+ import:
+ filter:
+ name: trunk-import-dependency-external
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-dependency
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: unmanaged
+ import:
+ filter:
+ portRef: trunk-import-dependency
+ projectRef: trunk-import-dependency
diff --git a/internal/controllers/trunk/tests/trunk-import-dependency/00-secret.yaml b/internal/controllers/trunk/tests/trunk-import-dependency/00-secret.yaml
new file mode 100644
index 00000000..045711ee
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-dependency/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/trunk/tests/trunk-import-dependency/01-assert.yaml b/internal/controllers/trunk/tests/trunk-import-dependency/01-assert.yaml
new file mode 100644
index 00000000..8190ecc7
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-dependency/01-assert.yaml
@@ -0,0 +1,34 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-dependency-not-this-one
+status:
+ conditions:
+ - type: Available
+ message: OpenStack resource is available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ message: OpenStack resource is up to date
+ status: "False"
+ reason: Success
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-dependency
+status:
+ conditions:
+ - type: Available
+ message: |-
+ Waiting for Port/trunk-import-dependency to be ready
+ Waiting for Project/trunk-import-dependency to be ready
+ status: "False"
+ reason: Progressing
+ - type: Progressing
+ message: |-
+ Waiting for Port/trunk-import-dependency to be ready
+ Waiting for Project/trunk-import-dependency to be ready
+ status: "True"
+ reason: Progressing
diff --git a/internal/controllers/trunk/tests/trunk-import-dependency/01-create-trap-resource.yaml b/internal/controllers/trunk/tests/trunk-import-dependency/01-create-trap-resource.yaml
new file mode 100644
index 00000000..074f801d
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-dependency/01-create-trap-resource.yaml
@@ -0,0 +1,54 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Network
+metadata:
+ name: trunk-import-dependency
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ name: trunk-import-dependency
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Subnet
+metadata:
+ name: trunk-import-dependency
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-import-dependency
+ ipVersion: 4
+ cidr: 192.168.161.0/24
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-import-dependency-not-this-one
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-import-dependency
+ addresses:
+ - subnetRef: trunk-import-dependency
+---
+# This `trunk-import-dependency-not-this-one` should not be picked by the import filter
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-dependency-not-this-one
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ portRef: trunk-import-dependency-not-this-one
+ description: Trunk trunk-import-dependency-not-this-one from "trunk-import-dependency" test
diff --git a/internal/controllers/trunk/tests/trunk-import-dependency/02-assert.yaml b/internal/controllers/trunk/tests/trunk-import-dependency/02-assert.yaml
new file mode 100644
index 00000000..a57266e4
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-dependency/02-assert.yaml
@@ -0,0 +1,39 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+resourceRefs:
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Trunk
+ name: trunk-import-dependency
+ ref: trunk1
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Trunk
+ name: trunk-import-dependency-not-this-one
+ ref: trunk2
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Port
+ name: trunk-import-dependency
+ ref: port
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Project
+ name: trunk-import-dependency
+ ref: project
+assertAll:
+ - celExpr: "trunk1.status.id != trunk2.status.id"
+ - celExpr: "trunk1.status.resource.portID == port.status.id"
+ - celExpr: "trunk1.status.resource.projectID == project.status.id"
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-dependency
+status:
+ conditions:
+ - type: Available
+ message: OpenStack resource is available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ message: OpenStack resource is up to date
+ status: "False"
+ reason: Success
diff --git a/internal/controllers/trunk/tests/trunk-import-dependency/02-create-resource.yaml b/internal/controllers/trunk/tests/trunk-import-dependency/02-create-resource.yaml
new file mode 100644
index 00000000..7530c3f9
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-dependency/02-create-resource.yaml
@@ -0,0 +1,40 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-import-dependency-external
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-import-dependency
+ addresses:
+ - subnetRef: trunk-import-dependency
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Project
+metadata:
+ name: trunk-import-dependency-external
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack-admin
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ name: trunk-import-dependency-external
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-dependency-external
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack-admin
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ portRef: trunk-import-dependency-external
+ projectRef: trunk-import-dependency-external
+ description: Trunk trunk-import-dependency-external from "trunk-import-dependency" test
diff --git a/internal/controllers/trunk/tests/trunk-import-dependency/03-assert.yaml b/internal/controllers/trunk/tests/trunk-import-dependency/03-assert.yaml
new file mode 100644
index 00000000..88388e78
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-dependency/03-assert.yaml
@@ -0,0 +1,8 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+commands:
+- script: "! kubectl get port trunk-import-dependency --namespace $NAMESPACE"
+ skipLogOutput: true
+- script: "! kubectl get project trunk-import-dependency --namespace $NAMESPACE"
+ skipLogOutput: true
diff --git a/internal/controllers/trunk/tests/trunk-import-dependency/03-delete-import-dependencies.yaml b/internal/controllers/trunk/tests/trunk-import-dependency/03-delete-import-dependencies.yaml
new file mode 100644
index 00000000..c1748945
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-dependency/03-delete-import-dependencies.yaml
@@ -0,0 +1,9 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestStep
+commands:
+ # We should be able to delete the import dependencies
+ - command: kubectl delete port trunk-import-dependency
+ namespaced: true
+ - command: kubectl delete project trunk-import-dependency
+ namespaced: true
diff --git a/internal/controllers/trunk/tests/trunk-import-dependency/04-assert.yaml b/internal/controllers/trunk/tests/trunk-import-dependency/04-assert.yaml
new file mode 100644
index 00000000..cf9454e5
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-dependency/04-assert.yaml
@@ -0,0 +1,6 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+commands:
+- script: "! kubectl get trunk trunk-import-dependency --namespace $NAMESPACE"
+ skipLogOutput: true
diff --git a/internal/controllers/trunk/tests/trunk-import-dependency/04-delete-resource.yaml b/internal/controllers/trunk/tests/trunk-import-dependency/04-delete-resource.yaml
new file mode 100644
index 00000000..10b0d3c7
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-dependency/04-delete-resource.yaml
@@ -0,0 +1,7 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestStep
+delete:
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Trunk
+ name: trunk-import-dependency
diff --git a/internal/controllers/trunk/tests/trunk-import-dependency/README.md b/internal/controllers/trunk/tests/trunk-import-dependency/README.md
new file mode 100644
index 00000000..386f4830
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-dependency/README.md
@@ -0,0 +1,29 @@
+# Check dependency handling for imported Trunk
+
+## Step 00
+
+Import a Trunk that references other imported resources. The referenced imported resources have no matching resources yet.
+Verify the Trunk is waiting for the dependency to be ready.
+
+## Step 01
+
+Create a Trunk matching the import filter, except for referenced resources, and verify that it's not being imported.
+
+## Step 02
+
+Create the referenced resources and a Trunk matching the import filters.
+
+Verify that the observed status on the imported Trunk corresponds to the spec of the created Trunk.
+
+## Step 03
+
+Delete the referenced resources and check that ORC does not prevent deletion. The OpenStack resources still exist because they
+were imported resources and we only deleted the ORC representation of it.
+
+## Step 04
+
+Delete the Trunk and validate that all resources are gone.
+
+## Reference
+
+https://k-orc.cloud/development/writing-tests/#import-dependency
diff --git a/internal/controllers/trunk/tests/trunk-import-error/00-assert.yaml b/internal/controllers/trunk/tests/trunk-import-error/00-assert.yaml
new file mode 100644
index 00000000..6e538ab9
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-error/00-assert.yaml
@@ -0,0 +1,30 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-error-external-1
+status:
+ conditions:
+ - type: Available
+ message: OpenStack resource is available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ message: OpenStack resource is up to date
+ status: "False"
+ reason: Success
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-error-external-2
+status:
+ conditions:
+ - type: Available
+ message: OpenStack resource is available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ message: OpenStack resource is up to date
+ status: "False"
+ reason: Success
diff --git a/internal/controllers/trunk/tests/trunk-import-error/00-create-resources.yaml b/internal/controllers/trunk/tests/trunk-import-error/00-create-resources.yaml
new file mode 100644
index 00000000..664ac963
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-error/00-create-resources.yaml
@@ -0,0 +1,80 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Network
+metadata:
+ name: trunk-import-error
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ name: trunk-import-error
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Subnet
+metadata:
+ name: trunk-import-error
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-import-error
+ ipVersion: 4
+ cidr: 192.168.157.0/24
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-import-error-1
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-import-error
+ addresses:
+ - subnetRef: trunk-import-error
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-import-error-2
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-import-error
+ addresses:
+ - subnetRef: trunk-import-error
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-error-external-1
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ description: Trunk from "import error" test
+ portRef: trunk-import-error-1
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-error-external-2
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ description: Trunk from "import error" test
+ portRef: trunk-import-error-2
diff --git a/internal/controllers/trunk/tests/trunk-import-error/00-secret.yaml b/internal/controllers/trunk/tests/trunk-import-error/00-secret.yaml
new file mode 100644
index 00000000..045711ee
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-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/trunk/tests/trunk-import-error/01-assert.yaml b/internal/controllers/trunk/tests/trunk-import-error/01-assert.yaml
new file mode 100644
index 00000000..1f48b6bb
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-error/01-assert.yaml
@@ -0,0 +1,15 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-error
+status:
+ conditions:
+ - type: Available
+ message: found more than one matching OpenStack resource during import
+ status: "False"
+ reason: InvalidConfiguration
+ - type: Progressing
+ message: found more than one matching OpenStack resource during import
+ status: "False"
+ reason: InvalidConfiguration
diff --git a/internal/controllers/trunk/tests/trunk-import-error/01-import-resource.yaml b/internal/controllers/trunk/tests/trunk-import-error/01-import-resource.yaml
new file mode 100644
index 00000000..d3d92285
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-error/01-import-resource.yaml
@@ -0,0 +1,13 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-error
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: unmanaged
+ import:
+ filter:
+ description: Trunk from "import error" test
diff --git a/internal/controllers/trunk/tests/trunk-import-error/README.md b/internal/controllers/trunk/tests/trunk-import-error/README.md
new file mode 100644
index 00000000..ce3ec498
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import-error/README.md
@@ -0,0 +1,13 @@
+# Import Trunk with more than one matching resources
+
+## Step 00
+
+Create two Trunks with identical specs.
+
+## Step 01
+
+Ensure that an imported Trunk with a filter matching the resources returns an error.
+
+## Reference
+
+https://k-orc.cloud/development/writing-tests/#import-error
diff --git a/internal/controllers/trunk/tests/trunk-import/00-assert.yaml b/internal/controllers/trunk/tests/trunk-import/00-assert.yaml
new file mode 100644
index 00000000..26ad45e5
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import/00-assert.yaml
@@ -0,0 +1,15 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import
+status:
+ conditions:
+ - type: Available
+ message: Waiting for Port/trunk-import to be created
+ status: "False"
+ reason: Progressing
+ - type: Progressing
+ message: Waiting for Port/trunk-import to be created
+ status: "True"
+ reason: Progressing
diff --git a/internal/controllers/trunk/tests/trunk-import/00-import-resource.yaml b/internal/controllers/trunk/tests/trunk-import/00-import-resource.yaml
new file mode 100644
index 00000000..0787dae7
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import/00-import-resource.yaml
@@ -0,0 +1,15 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: unmanaged
+ import:
+ filter:
+ name: trunk-import-external
+ description: Trunk trunk-import-external from "trunk-import" test
+ portRef: trunk-import
diff --git a/internal/controllers/trunk/tests/trunk-import/00-secret.yaml b/internal/controllers/trunk/tests/trunk-import/00-secret.yaml
new file mode 100644
index 00000000..045711ee
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import/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/trunk/tests/trunk-import/01-assert.yaml b/internal/controllers/trunk/tests/trunk-import/01-assert.yaml
new file mode 100644
index 00000000..1dcdcf1f
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import/01-assert.yaml
@@ -0,0 +1,33 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-external-not-this-one
+status:
+ conditions:
+ - type: Available
+ message: OpenStack resource is available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ message: OpenStack resource is up to date
+ status: "False"
+ reason: Success
+ resource:
+ name: trunk-import-external-not-this-one
+ description: Trunk trunk-import-external-not-this-one from "trunk-import" test
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import
+status:
+ conditions:
+ - type: Available
+ message: Waiting for Port/trunk-import to be created
+ status: "False"
+ reason: Progressing
+ - type: Progressing
+ message: Waiting for Port/trunk-import to be created
+ status: "True"
+ reason: Progressing
diff --git a/internal/controllers/trunk/tests/trunk-import/01-create-trap-resource.yaml b/internal/controllers/trunk/tests/trunk-import/01-create-trap-resource.yaml
new file mode 100644
index 00000000..f900b8ba
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import/01-create-trap-resource.yaml
@@ -0,0 +1,56 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Network
+metadata:
+ name: trunk-import
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ name: trunk-import
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Subnet
+metadata:
+ name: trunk-import
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ cidr: 192.168.162.0/24
+ ipVersion: 4
+ networkRef: trunk-import
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-import-external-not-this-one
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-import
+ addresses:
+ - subnetRef: trunk-import
+---
+# This `trunk-import-external-not-this-one` resource serves two purposes:
+# - ensure that we can successfully create another resource which name is a substring of it (i.e. it's not being adopted)
+# - ensure that importing a resource which name is a substring of it will not pick this one.
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-external-not-this-one
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ description: Trunk trunk-import-external-not-this-one from "trunk-import" test
+ portRef: trunk-import-external-not-this-one
diff --git a/internal/controllers/trunk/tests/trunk-import/02-assert.yaml b/internal/controllers/trunk/tests/trunk-import/02-assert.yaml
new file mode 100644
index 00000000..9bd9c508
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import/02-assert.yaml
@@ -0,0 +1,32 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+resourceRefs:
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Trunk
+ name: trunk-import-external
+ ref: trunk1
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Trunk
+ name: trunk-import-external-not-this-one
+ ref: trunk2
+assertAll:
+ - celExpr: "trunk1.status.id != trunk2.status.id"
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import
+status:
+ conditions:
+ - type: Available
+ message: OpenStack resource is available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ message: OpenStack resource is up to date
+ status: "False"
+ reason: Success
+ resource:
+ name: trunk-import-external
+ description: Trunk trunk-import-external from "trunk-import" test
diff --git a/internal/controllers/trunk/tests/trunk-import/02-create-resource.yaml b/internal/controllers/trunk/tests/trunk-import/02-create-resource.yaml
new file mode 100644
index 00000000..21ab9d8b
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import/02-create-resource.yaml
@@ -0,0 +1,27 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-import
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-import
+ addresses:
+ - subnetRef: trunk-import
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-import-external
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ description: Trunk trunk-import-external from "trunk-import" test
+ portRef: trunk-import
diff --git a/internal/controllers/trunk/tests/trunk-import/README.md b/internal/controllers/trunk/tests/trunk-import/README.md
new file mode 100644
index 00000000..a0d99d2c
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-import/README.md
@@ -0,0 +1,18 @@
+# Import Trunk
+
+## Step 00
+
+Import a trunk that matches all fields in the filter, and verify it is waiting for the external resource to be created.
+
+## Step 01
+
+Create a trunk whose name is a superstring of the one specified in the import filter, otherwise matching the filter, and verify that it's not being imported.
+
+## Step 02
+
+Create a trunk matching the filter and verify that the observed status on the imported trunk corresponds to the spec of the created trunk.
+Also, confirm that it does not adopt any trunk whose name is a superstring of its own.
+
+## Reference
+
+https://k-orc.cloud/development/writing-tests/#import
diff --git a/internal/controllers/trunk/tests/trunk-update/00-assert.yaml b/internal/controllers/trunk/tests/trunk-update/00-assert.yaml
new file mode 100644
index 00000000..92a89817
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-update/00-assert.yaml
@@ -0,0 +1,25 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+resourceRefs:
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Trunk
+ name: trunk-update
+ ref: trunk
+assertAll:
+ - celExpr: "!has(trunk.status.resource.description)"
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-update
+status:
+ resource:
+ name: trunk-update
+ conditions:
+ - type: Available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ status: "False"
+ reason: Success
diff --git a/internal/controllers/trunk/tests/trunk-update/00-minimal-resource.yaml b/internal/controllers/trunk/tests/trunk-update/00-minimal-resource.yaml
new file mode 100644
index 00000000..99de2965
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-update/00-minimal-resource.yaml
@@ -0,0 +1,12 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-update
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ portRef: trunk-update
diff --git a/internal/controllers/trunk/tests/trunk-update/00-prerequisites.yaml b/internal/controllers/trunk/tests/trunk-update/00-prerequisites.yaml
new file mode 100644
index 00000000..db6b1140
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-update/00-prerequisites.yaml
@@ -0,0 +1,47 @@
+---
+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
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Network
+metadata:
+ name: trunk-update
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ name: trunk-update
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Subnet
+metadata:
+ name: trunk-update
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-update
+ cidr: 192.168.158.0/24
+ ipVersion: 4
+ enableDHCP: false
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Port
+metadata:
+ name: trunk-update
+spec:
+ cloudCredentialsRef:
+ cloudName: openstack
+ secretName: openstack-clouds
+ managementPolicy: managed
+ resource:
+ networkRef: trunk-update
+ addresses:
+ - subnetRef: trunk-update
diff --git a/internal/controllers/trunk/tests/trunk-update/01-assert.yaml b/internal/controllers/trunk/tests/trunk-update/01-assert.yaml
new file mode 100644
index 00000000..7b644691
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-update/01-assert.yaml
@@ -0,0 +1,16 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-update
+status:
+ resource:
+ name: trunk-update-updated
+ description: trunk-update-updated
+ conditions:
+ - type: Available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ status: "False"
+ reason: Success
diff --git a/internal/controllers/trunk/tests/trunk-update/01-updated-resource.yaml b/internal/controllers/trunk/tests/trunk-update/01-updated-resource.yaml
new file mode 100644
index 00000000..d15f198a
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-update/01-updated-resource.yaml
@@ -0,0 +1,9 @@
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-update
+spec:
+ resource:
+ name: trunk-update-updated
+ description: trunk-update-updated
diff --git a/internal/controllers/trunk/tests/trunk-update/02-assert.yaml b/internal/controllers/trunk/tests/trunk-update/02-assert.yaml
new file mode 100644
index 00000000..92a89817
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-update/02-assert.yaml
@@ -0,0 +1,25 @@
+---
+apiVersion: kuttl.dev/v1beta1
+kind: TestAssert
+resourceRefs:
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Trunk
+ name: trunk-update
+ ref: trunk
+assertAll:
+ - celExpr: "!has(trunk.status.resource.description)"
+---
+apiVersion: openstack.k-orc.cloud/v1alpha1
+kind: Trunk
+metadata:
+ name: trunk-update
+status:
+ resource:
+ name: trunk-update
+ conditions:
+ - type: Available
+ status: "True"
+ reason: Success
+ - type: Progressing
+ status: "False"
+ reason: Success
diff --git a/internal/controllers/trunk/tests/trunk-update/02-reverted-resource.yaml b/internal/controllers/trunk/tests/trunk-update/02-reverted-resource.yaml
new file mode 100644
index 00000000..2c6c253f
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-update/02-reverted-resource.yaml
@@ -0,0 +1,7 @@
+# NOTE: kuttl only does patch updates, which means we can't delete a field.
+# We have to use a kubectl apply command instead.
+apiVersion: kuttl.dev/v1beta1
+kind: TestStep
+commands:
+ - command: kubectl replace -f 00-minimal-resource.yaml
+ namespaced: true
diff --git a/internal/controllers/trunk/tests/trunk-update/03-delete-resources.yaml b/internal/controllers/trunk/tests/trunk-update/03-delete-resources.yaml
new file mode 100644
index 00000000..4473d36d
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-update/03-delete-resources.yaml
@@ -0,0 +1,15 @@
+apiVersion: kuttl.dev/v1beta1
+kind: TestStep
+delete:
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Trunk
+ name: trunk-update
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Port
+ name: trunk-update
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Subnet
+ name: trunk-update
+ - apiVersion: openstack.k-orc.cloud/v1alpha1
+ kind: Network
+ name: trunk-update
\ No newline at end of file
diff --git a/internal/controllers/trunk/tests/trunk-update/README.md b/internal/controllers/trunk/tests/trunk-update/README.md
new file mode 100644
index 00000000..a7040db7
--- /dev/null
+++ b/internal/controllers/trunk/tests/trunk-update/README.md
@@ -0,0 +1,17 @@
+# Update Trunk
+
+## Step 00
+
+Create a Trunk using only mandatory fields.
+
+## Step 01
+
+Update all mutable fields.
+
+## Step 02
+
+Revert the resource to its original value and verify that the resulting object matches its state when first created.
+
+## Reference
+
+https://k-orc.cloud/development/writing-tests/#update
diff --git a/internal/controllers/trunk/zz_generated.adapter.go b/internal/controllers/trunk/zz_generated.adapter.go
new file mode 100644
index 00000000..9e6bef3b
--- /dev/null
+++ b/internal/controllers/trunk/zz_generated.adapter.go
@@ -0,0 +1,88 @@
+// Code generated by resource-generator. DO NOT EDIT.
+/*
+Copyright 2025 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 trunk
+
+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.Trunk
+ orcObjectListT = orcv1alpha1.TrunkList
+ resourceSpecT = orcv1alpha1.TrunkResourceSpec
+ filterT = orcv1alpha1.TrunkFilter
+)
+
+// Derived types
+type (
+ orcObjectPT = *orcObjectT
+ adapterI = interfaces.APIObjectAdapter[orcObjectPT, resourceSpecT, filterT]
+ adapterT = trunkAdapter
+)
+
+type trunkAdapter struct {
+ *orcv1alpha1.Trunk
+}
+
+var _ adapterI = &adapterT{}
+
+func (f adapterT) GetObject() orcObjectPT {
+ return f.Trunk
+}
+
+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/trunk/zz_generated.controller.go b/internal/controllers/trunk/zz_generated.controller.go
new file mode 100644
index 00000000..e99ea3d0
--- /dev/null
+++ b/internal/controllers/trunk/zz_generated.controller.go
@@ -0,0 +1,45 @@
+// Code generated by resource-generator. DO NOT EDIT.
+/*
+Copyright 2025 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 trunk
+
+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 47292b65..03bff669 100644
--- a/internal/osclients/mock/doc.go
+++ b/internal/osclients/mock/doc.go
@@ -50,6 +50,9 @@ import (
//go:generate mockgen -package mock -destination=service.go -source=../service.go github.com/k-orc/openstack-resource-controller/internal/osclients/mock ServiceClient
//go:generate /usr/bin/env bash -c "cat ../../../hack/boilerplate.go.txt service.go > _service.go && mv _service.go service.go"
+//go:generate mockgen -package mock -destination=trunk.go -source=../trunk.go github.com/k-orc/openstack-resource-controller/internal/osclients/mock TrunkClient
+//go:generate /usr/bin/env bash -c "cat ../../../hack/boilerplate.go.txt trunk.go > _trunk.go && mv _trunk.go trunk.go"
+
//go:generate mockgen -package mock -destination=volume.go -source=../volume.go github.com/k-orc/openstack-resource-controller/internal/osclients/mock VolumeClient
//go:generate /usr/bin/env bash -c "cat ../../../hack/boilerplate.go.txt volume.go > _volume.go && mv _volume.go volume.go"
diff --git a/internal/osclients/mock/networking.go b/internal/osclients/mock/networking.go
index 9b5e2504..41baf525 100644
--- a/internal/osclients/mock/networking.go
+++ b/internal/osclients/mock/networking.go
@@ -34,6 +34,7 @@ import (
routers "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/layer3/routers"
groups "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/security/groups"
rules "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/security/rules"
+ trunks "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/trunks"
networks "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/networks"
ports "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/ports"
subnets "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/subnets"
@@ -80,6 +81,21 @@ func (mr *MockNetworkClientMockRecorder) AddRouterInterface(ctx, id, opts any) *
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRouterInterface", reflect.TypeOf((*MockNetworkClient)(nil).AddRouterInterface), ctx, id, opts)
}
+// AddSubports mocks base method.
+func (m *MockNetworkClient) AddSubports(ctx context.Context, id string, opts trunks.AddSubportsOptsBuilder) (*trunks.Trunk, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "AddSubports", ctx, id, opts)
+ ret0, _ := ret[0].(*trunks.Trunk)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// AddSubports indicates an expected call of AddSubports.
+func (mr *MockNetworkClientMockRecorder) AddSubports(ctx, id, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddSubports", reflect.TypeOf((*MockNetworkClient)(nil).AddSubports), ctx, id, opts)
+}
+
// CreateFloatingIP mocks base method.
func (m *MockNetworkClient) CreateFloatingIP(ctx context.Context, opts floatingips.CreateOptsBuilder) (*floatingips.FloatingIP, error) {
m.ctrl.T.Helper()
@@ -185,6 +201,21 @@ func (mr *MockNetworkClientMockRecorder) CreateSubnet(ctx, opts any) *gomock.Cal
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateSubnet", reflect.TypeOf((*MockNetworkClient)(nil).CreateSubnet), ctx, opts)
}
+// CreateTrunk mocks base method.
+func (m *MockNetworkClient) CreateTrunk(ctx context.Context, opts trunks.CreateOptsBuilder) (*trunks.Trunk, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "CreateTrunk", ctx, opts)
+ ret0, _ := ret[0].(*trunks.Trunk)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// CreateTrunk indicates an expected call of CreateTrunk.
+func (mr *MockNetworkClientMockRecorder) CreateTrunk(ctx, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTrunk", reflect.TypeOf((*MockNetworkClient)(nil).CreateTrunk), ctx, opts)
+}
+
// DeleteFloatingIP mocks base method.
func (m *MockNetworkClient) DeleteFloatingIP(ctx context.Context, id string) error {
m.ctrl.T.Helper()
@@ -283,6 +314,20 @@ func (mr *MockNetworkClientMockRecorder) DeleteSubnet(ctx, id any) *gomock.Call
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSubnet", reflect.TypeOf((*MockNetworkClient)(nil).DeleteSubnet), ctx, id)
}
+// DeleteTrunk mocks base method.
+func (m *MockNetworkClient) DeleteTrunk(ctx context.Context, id string) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "DeleteTrunk", ctx, id)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// DeleteTrunk indicates an expected call of DeleteTrunk.
+func (mr *MockNetworkClientMockRecorder) DeleteTrunk(ctx, id any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTrunk", reflect.TypeOf((*MockNetworkClient)(nil).DeleteTrunk), ctx, id)
+}
+
// GetFloatingIP mocks base method.
func (m *MockNetworkClient) GetFloatingIP(ctx context.Context, id string) (*floatingips.FloatingIP, error) {
m.ctrl.T.Helper()
@@ -388,6 +433,21 @@ func (mr *MockNetworkClientMockRecorder) GetSubnet(ctx, id any) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubnet", reflect.TypeOf((*MockNetworkClient)(nil).GetSubnet), ctx, id)
}
+// GetTrunk mocks base method.
+func (m *MockNetworkClient) GetTrunk(ctx context.Context, id string) (*trunks.Trunk, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetTrunk", ctx, id)
+ ret0, _ := ret[0].(*trunks.Trunk)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GetTrunk indicates an expected call of GetTrunk.
+func (mr *MockNetworkClientMockRecorder) GetTrunk(ctx, id any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrunk", reflect.TypeOf((*MockNetworkClient)(nil).GetTrunk), ctx, id)
+}
+
// ListFloatingIP mocks base method.
func (m *MockNetworkClient) ListFloatingIP(ctx context.Context, opts floatingips.ListOptsBuilder) iter.Seq2[*floatingips.FloatingIP, error] {
m.ctrl.T.Helper()
@@ -487,6 +547,36 @@ func (mr *MockNetworkClientMockRecorder) ListSubnet(ctx, opts any) *gomock.Call
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSubnet", reflect.TypeOf((*MockNetworkClient)(nil).ListSubnet), ctx, opts)
}
+// ListTrunk mocks base method.
+func (m *MockNetworkClient) ListTrunk(ctx context.Context, opts trunks.ListOptsBuilder) ([]trunks.Trunk, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "ListTrunk", ctx, opts)
+ ret0, _ := ret[0].([]trunks.Trunk)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// ListTrunk indicates an expected call of ListTrunk.
+func (mr *MockNetworkClientMockRecorder) ListTrunk(ctx, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTrunk", reflect.TypeOf((*MockNetworkClient)(nil).ListTrunk), ctx, opts)
+}
+
+// ListTrunkSubports mocks base method.
+func (m *MockNetworkClient) ListTrunkSubports(ctx context.Context, trunkID string) ([]trunks.Subport, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "ListTrunkSubports", ctx, trunkID)
+ ret0, _ := ret[0].([]trunks.Subport)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// ListTrunkSubports indicates an expected call of ListTrunkSubports.
+func (mr *MockNetworkClientMockRecorder) ListTrunkSubports(ctx, trunkID any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTrunkSubports", reflect.TypeOf((*MockNetworkClient)(nil).ListTrunkSubports), ctx, trunkID)
+}
+
// RemoveRouterInterface mocks base method.
func (m *MockNetworkClient) RemoveRouterInterface(ctx context.Context, id string, opts routers.RemoveInterfaceOptsBuilder) (*routers.InterfaceInfo, error) {
m.ctrl.T.Helper()
@@ -502,6 +592,20 @@ func (mr *MockNetworkClientMockRecorder) RemoveRouterInterface(ctx, id, opts any
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveRouterInterface", reflect.TypeOf((*MockNetworkClient)(nil).RemoveRouterInterface), ctx, id, opts)
}
+// RemoveSubports mocks base method.
+func (m *MockNetworkClient) RemoveSubports(ctx context.Context, id string, opts trunks.RemoveSubportsOptsBuilder) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "RemoveSubports", ctx, id, opts)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// RemoveSubports indicates an expected call of RemoveSubports.
+func (mr *MockNetworkClientMockRecorder) RemoveSubports(ctx, id, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveSubports", reflect.TypeOf((*MockNetworkClient)(nil).RemoveSubports), ctx, id, opts)
+}
+
// ReplaceAllAttributesTags mocks base method.
func (m *MockNetworkClient) ReplaceAllAttributesTags(ctx context.Context, resourceType, resourceID string, opts attributestags.ReplaceAllOptsBuilder) ([]string, error) {
m.ctrl.T.Helper()
@@ -606,3 +710,18 @@ func (mr *MockNetworkClientMockRecorder) UpdateSubnet(ctx, id, opts any) *gomock
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSubnet", reflect.TypeOf((*MockNetworkClient)(nil).UpdateSubnet), ctx, id, opts)
}
+
+// UpdateTrunk mocks base method.
+func (m *MockNetworkClient) UpdateTrunk(ctx context.Context, id string, opts trunks.UpdateOptsBuilder) (*trunks.Trunk, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "UpdateTrunk", ctx, id, opts)
+ ret0, _ := ret[0].(*trunks.Trunk)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// UpdateTrunk indicates an expected call of UpdateTrunk.
+func (mr *MockNetworkClientMockRecorder) UpdateTrunk(ctx, id, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTrunk", reflect.TypeOf((*MockNetworkClient)(nil).UpdateTrunk), ctx, id, opts)
+}
diff --git a/internal/osclients/mock/trunk.go b/internal/osclients/mock/trunk.go
new file mode 100644
index 00000000..23717a26
--- /dev/null
+++ b/internal/osclients/mock/trunk.go
@@ -0,0 +1,131 @@
+/*
+Copyright 2025 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: ../trunk.go
+//
+// Generated by this command:
+//
+// mockgen -package mock -destination=trunk.go -source=../trunk.go github.com/k-orc/openstack-resource-controller/internal/osclients/mock TrunkClient
+//
+
+// Package mock is a generated GoMock package.
+package mock
+
+import (
+ context "context"
+ iter "iter"
+ reflect "reflect"
+
+ trunks "github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/trunks"
+ gomock "go.uber.org/mock/gomock"
+)
+
+// MockTrunkClient is a mock of TrunkClient interface.
+type MockTrunkClient struct {
+ ctrl *gomock.Controller
+ recorder *MockTrunkClientMockRecorder
+ isgomock struct{}
+}
+
+// MockTrunkClientMockRecorder is the mock recorder for MockTrunkClient.
+type MockTrunkClientMockRecorder struct {
+ mock *MockTrunkClient
+}
+
+// NewMockTrunkClient creates a new mock instance.
+func NewMockTrunkClient(ctrl *gomock.Controller) *MockTrunkClient {
+ mock := &MockTrunkClient{ctrl: ctrl}
+ mock.recorder = &MockTrunkClientMockRecorder{mock}
+ return mock
+}
+
+// EXPECT returns an object that allows the caller to indicate expected use.
+func (m *MockTrunkClient) EXPECT() *MockTrunkClientMockRecorder {
+ return m.recorder
+}
+
+// CreateTrunk mocks base method.
+func (m *MockTrunkClient) CreateTrunk(ctx context.Context, opts trunks.CreateOptsBuilder) (*trunks.Trunk, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "CreateTrunk", ctx, opts)
+ ret0, _ := ret[0].(*trunks.Trunk)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// CreateTrunk indicates an expected call of CreateTrunk.
+func (mr *MockTrunkClientMockRecorder) CreateTrunk(ctx, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTrunk", reflect.TypeOf((*MockTrunkClient)(nil).CreateTrunk), ctx, opts)
+}
+
+// DeleteTrunk mocks base method.
+func (m *MockTrunkClient) DeleteTrunk(ctx context.Context, resourceID string) error {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "DeleteTrunk", ctx, resourceID)
+ ret0, _ := ret[0].(error)
+ return ret0
+}
+
+// DeleteTrunk indicates an expected call of DeleteTrunk.
+func (mr *MockTrunkClientMockRecorder) DeleteTrunk(ctx, resourceID any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTrunk", reflect.TypeOf((*MockTrunkClient)(nil).DeleteTrunk), ctx, resourceID)
+}
+
+// GetTrunk mocks base method.
+func (m *MockTrunkClient) GetTrunk(ctx context.Context, resourceID string) (*trunks.Trunk, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetTrunk", ctx, resourceID)
+ ret0, _ := ret[0].(*trunks.Trunk)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GetTrunk indicates an expected call of GetTrunk.
+func (mr *MockTrunkClientMockRecorder) GetTrunk(ctx, resourceID any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrunk", reflect.TypeOf((*MockTrunkClient)(nil).GetTrunk), ctx, resourceID)
+}
+
+// ListTrunks mocks base method.
+func (m *MockTrunkClient) ListTrunks(ctx context.Context, listOpts trunks.ListOptsBuilder) iter.Seq2[*trunks.Trunk, error] {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "ListTrunks", ctx, listOpts)
+ ret0, _ := ret[0].(iter.Seq2[*trunks.Trunk, error])
+ return ret0
+}
+
+// ListTrunks indicates an expected call of ListTrunks.
+func (mr *MockTrunkClientMockRecorder) ListTrunks(ctx, listOpts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTrunks", reflect.TypeOf((*MockTrunkClient)(nil).ListTrunks), ctx, listOpts)
+}
+
+// UpdateTrunk mocks base method.
+func (m *MockTrunkClient) UpdateTrunk(ctx context.Context, id string, opts trunks.UpdateOptsBuilder) (*trunks.Trunk, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "UpdateTrunk", ctx, id, opts)
+ ret0, _ := ret[0].(*trunks.Trunk)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// UpdateTrunk indicates an expected call of UpdateTrunk.
+func (mr *MockTrunkClientMockRecorder) UpdateTrunk(ctx, id, opts any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTrunk", reflect.TypeOf((*MockTrunkClient)(nil).UpdateTrunk), ctx, id, opts)
+}
diff --git a/internal/osclients/networking.go b/internal/osclients/networking.go
index 99156d64..74e99798 100644
--- a/internal/osclients/networking.go
+++ b/internal/osclients/networking.go
@@ -102,6 +102,15 @@ type NetworkClient interface {
GetSubnet(ctx context.Context, id string) (*subnets.Subnet, error)
UpdateSubnet(ctx context.Context, id string, opts subnets.UpdateOptsBuilder) (*subnets.Subnet, error)
+ ListTrunk(ctx context.Context, opts trunks.ListOptsBuilder) ([]trunks.Trunk, error)
+ GetTrunk(ctx context.Context, id string) (*trunks.Trunk, error)
+ CreateTrunk(ctx context.Context, opts trunks.CreateOptsBuilder) (*trunks.Trunk, error)
+ UpdateTrunk(ctx context.Context, id string, opts trunks.UpdateOptsBuilder) (*trunks.Trunk, error)
+ DeleteTrunk(ctx context.Context, id string) error
+ ListTrunkSubports(ctx context.Context, trunkID string) ([]trunks.Subport, error)
+ AddSubports(ctx context.Context, id string, opts trunks.AddSubportsOptsBuilder) (*trunks.Trunk, error)
+ RemoveSubports(ctx context.Context, id string, opts trunks.RemoveSubportsOptsBuilder) error
+
ReplaceAllAttributesTags(ctx context.Context, resourceType string, resourceID string, opts attributestags.ReplaceAllOptsBuilder) ([]string, error)
}
@@ -214,10 +223,18 @@ func (c networkClient) UpdatePort(ctx context.Context, id string, opts ports.Upd
return &portExt, nil
}
+func (c networkClient) GetTrunk(ctx context.Context, id string) (*trunks.Trunk, error) {
+ return trunks.Get(ctx, c.serviceClient, id).Extract()
+}
+
func (c networkClient) CreateTrunk(ctx context.Context, opts trunks.CreateOptsBuilder) (*trunks.Trunk, error) {
return trunks.Create(ctx, c.serviceClient, opts).Extract()
}
+func (c networkClient) UpdateTrunk(ctx context.Context, id string, opts trunks.UpdateOptsBuilder) (*trunks.Trunk, error) {
+ return trunks.Update(ctx, c.serviceClient, id, opts).Extract()
+}
+
func (c networkClient) DeleteTrunk(ctx context.Context, id string) error {
return trunks.Delete(ctx, c.serviceClient, id).ExtractErr()
}
@@ -226,10 +243,6 @@ func (c networkClient) ListTrunkSubports(ctx context.Context, trunkID string) ([
return trunks.GetSubports(ctx, c.serviceClient, trunkID).Extract()
}
-func (c networkClient) RemoveSubports(ctx context.Context, id string, opts trunks.RemoveSubportsOpts) error {
- _, err := trunks.RemoveSubports(ctx, c.serviceClient, id, opts).Extract()
- return err
-}
func (c networkClient) ListTrunk(ctx context.Context, opts trunks.ListOptsBuilder) ([]trunks.Trunk, error) {
allPages, err := trunks.List(c.serviceClient, opts).AllPages(ctx)
@@ -239,6 +252,15 @@ func (c networkClient) ListTrunk(ctx context.Context, opts trunks.ListOptsBuilde
return trunks.ExtractTrunks(allPages)
}
+func (c networkClient) AddSubports(ctx context.Context, id string, opts trunks.AddSubportsOptsBuilder) (*trunks.Trunk, error) {
+ return trunks.AddSubports(ctx, c.serviceClient, id, opts).Extract()
+}
+
+func (c networkClient) RemoveSubports(ctx context.Context, id string, opts trunks.RemoveSubportsOptsBuilder) error {
+ _, err := trunks.RemoveSubports(ctx, c.serviceClient, id, opts).Extract()
+ return err
+}
+
func (c networkClient) CreateRouter(ctx context.Context, opts routers.CreateOptsBuilder) (*routers.Router, error) {
return routers.Create(ctx, c.serviceClient, opts).Extract()
}
diff --git a/internal/osclients/trunk.go b/internal/osclients/trunk.go
new file mode 100644
index 00000000..2dbed4ed
--- /dev/null
+++ b/internal/osclients/trunk.go
@@ -0,0 +1,104 @@
+/*
+Copyright 2025 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/networking/v2/extensions/trunks"
+ "github.com/gophercloud/utils/v2/openstack/clientconfig"
+)
+
+type TrunkClient interface {
+ ListTrunks(ctx context.Context, listOpts trunks.ListOptsBuilder) iter.Seq2[*trunks.Trunk, error]
+ CreateTrunk(ctx context.Context, opts trunks.CreateOptsBuilder) (*trunks.Trunk, error)
+ DeleteTrunk(ctx context.Context, resourceID string) error
+ GetTrunk(ctx context.Context, resourceID string) (*trunks.Trunk, error)
+ UpdateTrunk(ctx context.Context, id string, opts trunks.UpdateOptsBuilder) (*trunks.Trunk, error)
+}
+
+type trunkClient struct{ client *gophercloud.ServiceClient }
+
+// NewTrunkClient returns a new OpenStack client.
+func NewTrunkClient(providerClient *gophercloud.ProviderClient, providerClientOpts *clientconfig.ClientOpts) (TrunkClient, error) {
+ client, err := openstack.NewNetworkV2(providerClient, gophercloud.EndpointOpts{
+ Region: providerClientOpts.RegionName,
+ Availability: clientconfig.GetEndpointType(providerClientOpts.EndpointType),
+ })
+
+ if err != nil {
+ return nil, fmt.Errorf("failed to create trunk service client: %v", err)
+ }
+
+ return &trunkClient{client}, nil
+}
+
+func (c trunkClient) ListTrunks(ctx context.Context, listOpts trunks.ListOptsBuilder) iter.Seq2[*trunks.Trunk, error] {
+ pager := trunks.List(c.client, listOpts)
+ return func(yield func(*trunks.Trunk, error) bool) {
+ _ = pager.EachPage(ctx, yieldPage(trunks.ExtractTrunks, yield))
+ }
+}
+
+func (c trunkClient) CreateTrunk(ctx context.Context, opts trunks.CreateOptsBuilder) (*trunks.Trunk, error) {
+ return trunks.Create(ctx, c.client, opts).Extract()
+}
+
+func (c trunkClient) DeleteTrunk(ctx context.Context, resourceID string) error {
+ return trunks.Delete(ctx, c.client, resourceID).ExtractErr()
+}
+
+func (c trunkClient) GetTrunk(ctx context.Context, resourceID string) (*trunks.Trunk, error) {
+ return trunks.Get(ctx, c.client, resourceID).Extract()
+}
+
+func (c trunkClient) UpdateTrunk(ctx context.Context, id string, opts trunks.UpdateOptsBuilder) (*trunks.Trunk, error) {
+ return trunks.Update(ctx, c.client, id, opts).Extract()
+}
+
+type trunkErrorClient struct{ error }
+
+// NewTrunkErrorClient returns a TrunkClient in which every method returns the given error.
+func NewTrunkErrorClient(e error) TrunkClient {
+ return trunkErrorClient{e}
+}
+
+func (e trunkErrorClient) ListTrunks(_ context.Context, _ trunks.ListOptsBuilder) iter.Seq2[*trunks.Trunk, error] {
+ return func(yield func(*trunks.Trunk, error) bool) {
+ yield(nil, e.error)
+ }
+}
+
+func (e trunkErrorClient) CreateTrunk(_ context.Context, _ trunks.CreateOptsBuilder) (*trunks.Trunk, error) {
+ return nil, e.error
+}
+
+func (e trunkErrorClient) DeleteTrunk(_ context.Context, _ string) error {
+ return e.error
+}
+
+func (e trunkErrorClient) GetTrunk(_ context.Context, _ string) (*trunks.Trunk, error) {
+ return nil, e.error
+}
+
+func (e trunkErrorClient) UpdateTrunk(_ context.Context, _ string, _ trunks.UpdateOptsBuilder) (*trunks.Trunk, error) {
+ return nil, e.error
+}
diff --git a/internal/scope/mock.go b/internal/scope/mock.go
index ef959fae..430baea3 100644
--- a/internal/scope/mock.go
+++ b/internal/scope/mock.go
@@ -43,6 +43,7 @@ type MockScopeFactory struct {
NetworkClient *mock.MockNetworkClient
RoleClient *mock.MockRoleClient
ServiceClient *mock.MockServiceClient
+ TrunkClient *mock.MockTrunkClient
VolumeClient *mock.MockVolumeClient
VolumeTypeClient *mock.MockVolumeTypeClient
@@ -59,6 +60,7 @@ func NewMockScopeFactory(mockCtrl *gomock.Controller) *MockScopeFactory {
networkClient := mock.NewMockNetworkClient(mockCtrl)
roleClient := mock.NewMockRoleClient(mockCtrl)
serviceClient := mock.NewMockServiceClient(mockCtrl)
+ trunkClient := mock.NewMockTrunkClient(mockCtrl)
volumeClient := mock.NewMockVolumeClient(mockCtrl)
volumetypeClient := mock.NewMockVolumeTypeClient(mockCtrl)
@@ -72,6 +74,7 @@ func NewMockScopeFactory(mockCtrl *gomock.Controller) *MockScopeFactory {
NetworkClient: networkClient,
RoleClient: roleClient,
ServiceClient: serviceClient,
+ TrunkClient: trunkClient,
VolumeClient: volumeClient,
VolumeTypeClient: volumetypeClient,
}
@@ -132,6 +135,10 @@ func (f *MockScopeFactory) NewRoleClient() (osclients.RoleClient, error) {
return f.RoleClient, nil
}
+func (f *MockScopeFactory) NewTrunkClient() (osclients.TrunkClient, error) {
+ return f.TrunkClient, nil
+}
+
func (f *MockScopeFactory) ExtractToken() (*tokens.Token, error) {
return &tokens.Token{ExpiresAt: time.Now().Add(24 * time.Hour)}, nil
}
diff --git a/internal/scope/provider.go b/internal/scope/provider.go
index 65670ba6..797109df 100644
--- a/internal/scope/provider.go
+++ b/internal/scope/provider.go
@@ -181,6 +181,10 @@ func (s *providerScope) NewRoleClient() (clients.RoleClient, error) {
return clients.NewRoleClient(s.providerClient, s.providerClientOpts)
}
+func (s *providerScope) NewTrunkClient() (clients.TrunkClient, error) {
+ return clients.NewTrunkClient(s.providerClient, s.providerClientOpts)
+}
+
func (s *providerScope) ExtractToken() (*tokens.Token, error) {
client, err := openstack.NewIdentityV3(s.providerClient, gophercloud.EndpointOpts{})
if err != nil {
diff --git a/internal/scope/scope.go b/internal/scope/scope.go
index 7da50dc8..8ce07a01 100644
--- a/internal/scope/scope.go
+++ b/internal/scope/scope.go
@@ -57,6 +57,7 @@ type Scope interface {
NewNetworkClient() (osclients.NetworkClient, error)
NewRoleClient() (osclients.RoleClient, error)
NewServiceClient() (osclients.ServiceClient, error)
+ NewTrunkClient() (osclients.TrunkClient, error)
NewVolumeClient() (osclients.VolumeClient, error)
NewVolumeTypeClient() (osclients.VolumeTypeClient, error)
ExtractToken() (*tokens.Token, error)
diff --git a/kuttl-test.yaml b/kuttl-test.yaml
index d499782e..67828d42 100644
--- a/kuttl-test.yaml
+++ b/kuttl-test.yaml
@@ -19,6 +19,7 @@ testDirs:
- ./internal/controllers/servergroup/tests/
- ./internal/controllers/service/tests/
- ./internal/controllers/subnet/tests/
+- ./internal/controllers/trunk/tests/
- ./internal/controllers/volume/tests/
- ./internal/controllers/volumetype/tests/
timeout: 240
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/trunk.go b/pkg/clients/applyconfiguration/api/v1alpha1/trunk.go
new file mode 100644
index 00000000..948d40e2
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/trunk.go
@@ -0,0 +1,281 @@
+/*
+Copyright 2025 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"
+)
+
+// TrunkApplyConfiguration represents a declarative configuration of the Trunk type for use
+// with apply.
+type TrunkApplyConfiguration struct {
+ v1.TypeMetaApplyConfiguration `json:",inline"`
+ *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
+ Spec *TrunkSpecApplyConfiguration `json:"spec,omitempty"`
+ Status *TrunkStatusApplyConfiguration `json:"status,omitempty"`
+}
+
+// Trunk constructs a declarative configuration of the Trunk type for use with
+// apply.
+func Trunk(name, namespace string) *TrunkApplyConfiguration {
+ b := &TrunkApplyConfiguration{}
+ b.WithName(name)
+ b.WithNamespace(namespace)
+ b.WithKind("Trunk")
+ b.WithAPIVersion("openstack.k-orc.cloud/v1alpha1")
+ return b
+}
+
+// ExtractTrunk extracts the applied configuration owned by fieldManager from
+// trunk. If no managedFields are found in trunk for fieldManager, a
+// TrunkApplyConfiguration 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.
+// trunk must be a unmodified Trunk API object that was retrieved from the Kubernetes API.
+// ExtractTrunk 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 ExtractTrunk(trunk *apiv1alpha1.Trunk, fieldManager string) (*TrunkApplyConfiguration, error) {
+ return extractTrunk(trunk, fieldManager, "")
+}
+
+// ExtractTrunkStatus is the same as ExtractTrunk except
+// that it extracts the status subresource applied configuration.
+// Experimental!
+func ExtractTrunkStatus(trunk *apiv1alpha1.Trunk, fieldManager string) (*TrunkApplyConfiguration, error) {
+ return extractTrunk(trunk, fieldManager, "status")
+}
+
+func extractTrunk(trunk *apiv1alpha1.Trunk, fieldManager string, subresource string) (*TrunkApplyConfiguration, error) {
+ b := &TrunkApplyConfiguration{}
+ err := managedfields.ExtractInto(trunk, internal.Parser().Type("com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.Trunk"), fieldManager, b, subresource)
+ if err != nil {
+ return nil, err
+ }
+ b.WithName(trunk.Name)
+ b.WithNamespace(trunk.Namespace)
+
+ b.WithKind("Trunk")
+ b.WithAPIVersion("openstack.k-orc.cloud/v1alpha1")
+ return b, nil
+}
+func (b TrunkApplyConfiguration) 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 *TrunkApplyConfiguration) WithKind(value string) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithAPIVersion(value string) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithName(value string) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithGenerateName(value string) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithNamespace(value string) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithUID(value types.UID) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithResourceVersion(value string) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithGeneration(value int64) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithCreationTimestamp(value metav1.Time) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithLabels(entries map[string]string) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithAnnotations(entries map[string]string) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithFinalizers(values ...string) *TrunkApplyConfiguration {
+ b.ensureObjectMetaApplyConfigurationExists()
+ for i := range values {
+ b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
+ }
+ return b
+}
+
+func (b *TrunkApplyConfiguration) 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 *TrunkApplyConfiguration) WithSpec(value *TrunkSpecApplyConfiguration) *TrunkApplyConfiguration {
+ 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 *TrunkApplyConfiguration) WithStatus(value *TrunkStatusApplyConfiguration) *TrunkApplyConfiguration {
+ b.Status = value
+ return b
+}
+
+// GetKind retrieves the value of the Kind field in the declarative configuration.
+func (b *TrunkApplyConfiguration) GetKind() *string {
+ return b.TypeMetaApplyConfiguration.Kind
+}
+
+// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
+func (b *TrunkApplyConfiguration) GetAPIVersion() *string {
+ return b.TypeMetaApplyConfiguration.APIVersion
+}
+
+// GetName retrieves the value of the Name field in the declarative configuration.
+func (b *TrunkApplyConfiguration) GetName() *string {
+ b.ensureObjectMetaApplyConfigurationExists()
+ return b.ObjectMetaApplyConfiguration.Name
+}
+
+// GetNamespace retrieves the value of the Namespace field in the declarative configuration.
+func (b *TrunkApplyConfiguration) GetNamespace() *string {
+ b.ensureObjectMetaApplyConfigurationExists()
+ return b.ObjectMetaApplyConfiguration.Namespace
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/trunkfilter.go b/pkg/clients/applyconfiguration/api/v1alpha1/trunkfilter.go
new file mode 100644
index 00000000..f7ddd8cc
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/trunkfilter.go
@@ -0,0 +1,129 @@
+/*
+Copyright 2025 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"
+)
+
+// TrunkFilterApplyConfiguration represents a declarative configuration of the TrunkFilter type for use
+// with apply.
+type TrunkFilterApplyConfiguration struct {
+ Name *apiv1alpha1.OpenStackName `json:"name,omitempty"`
+ Description *apiv1alpha1.NeutronDescription `json:"description,omitempty"`
+ PortRef *apiv1alpha1.KubernetesNameRef `json:"portRef,omitempty"`
+ ProjectRef *apiv1alpha1.KubernetesNameRef `json:"projectRef,omitempty"`
+ Status *string `json:"status,omitempty"`
+ AdminStateUp *bool `json:"adminStateUp,omitempty"`
+ FilterByNeutronTagsApplyConfiguration `json:",inline"`
+}
+
+// TrunkFilterApplyConfiguration constructs a declarative configuration of the TrunkFilter type for use with
+// apply.
+func TrunkFilter() *TrunkFilterApplyConfiguration {
+ return &TrunkFilterApplyConfiguration{}
+}
+
+// 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 *TrunkFilterApplyConfiguration) WithName(value apiv1alpha1.OpenStackName) *TrunkFilterApplyConfiguration {
+ b.Name = &value
+ return b
+}
+
+// WithDescription sets the Description 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 Description field is set to the value of the last call.
+func (b *TrunkFilterApplyConfiguration) WithDescription(value apiv1alpha1.NeutronDescription) *TrunkFilterApplyConfiguration {
+ b.Description = &value
+ return b
+}
+
+// WithPortRef sets the PortRef 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 PortRef field is set to the value of the last call.
+func (b *TrunkFilterApplyConfiguration) WithPortRef(value apiv1alpha1.KubernetesNameRef) *TrunkFilterApplyConfiguration {
+ b.PortRef = &value
+ return b
+}
+
+// WithProjectRef sets the ProjectRef 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 ProjectRef field is set to the value of the last call.
+func (b *TrunkFilterApplyConfiguration) WithProjectRef(value apiv1alpha1.KubernetesNameRef) *TrunkFilterApplyConfiguration {
+ b.ProjectRef = &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 *TrunkFilterApplyConfiguration) WithStatus(value string) *TrunkFilterApplyConfiguration {
+ b.Status = &value
+ return b
+}
+
+// WithAdminStateUp sets the AdminStateUp 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 AdminStateUp field is set to the value of the last call.
+func (b *TrunkFilterApplyConfiguration) WithAdminStateUp(value bool) *TrunkFilterApplyConfiguration {
+ b.AdminStateUp = &value
+ return b
+}
+
+// WithTags adds the given value to the Tags 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 Tags field.
+func (b *TrunkFilterApplyConfiguration) WithTags(values ...apiv1alpha1.NeutronTag) *TrunkFilterApplyConfiguration {
+ for i := range values {
+ b.FilterByNeutronTagsApplyConfiguration.Tags = append(b.FilterByNeutronTagsApplyConfiguration.Tags, values[i])
+ }
+ return b
+}
+
+// WithTagsAny adds the given value to the TagsAny 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 TagsAny field.
+func (b *TrunkFilterApplyConfiguration) WithTagsAny(values ...apiv1alpha1.NeutronTag) *TrunkFilterApplyConfiguration {
+ for i := range values {
+ b.FilterByNeutronTagsApplyConfiguration.TagsAny = append(b.FilterByNeutronTagsApplyConfiguration.TagsAny, values[i])
+ }
+ return b
+}
+
+// WithNotTags adds the given value to the NotTags 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 NotTags field.
+func (b *TrunkFilterApplyConfiguration) WithNotTags(values ...apiv1alpha1.NeutronTag) *TrunkFilterApplyConfiguration {
+ for i := range values {
+ b.FilterByNeutronTagsApplyConfiguration.NotTags = append(b.FilterByNeutronTagsApplyConfiguration.NotTags, values[i])
+ }
+ return b
+}
+
+// WithNotTagsAny adds the given value to the NotTagsAny 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 NotTagsAny field.
+func (b *TrunkFilterApplyConfiguration) WithNotTagsAny(values ...apiv1alpha1.NeutronTag) *TrunkFilterApplyConfiguration {
+ for i := range values {
+ b.FilterByNeutronTagsApplyConfiguration.NotTagsAny = append(b.FilterByNeutronTagsApplyConfiguration.NotTagsAny, values[i])
+ }
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/trunkimport.go b/pkg/clients/applyconfiguration/api/v1alpha1/trunkimport.go
new file mode 100644
index 00000000..5b482302
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/trunkimport.go
@@ -0,0 +1,48 @@
+/*
+Copyright 2025 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
+
+// TrunkImportApplyConfiguration represents a declarative configuration of the TrunkImport type for use
+// with apply.
+type TrunkImportApplyConfiguration struct {
+ ID *string `json:"id,omitempty"`
+ Filter *TrunkFilterApplyConfiguration `json:"filter,omitempty"`
+}
+
+// TrunkImportApplyConfiguration constructs a declarative configuration of the TrunkImport type for use with
+// apply.
+func TrunkImport() *TrunkImportApplyConfiguration {
+ return &TrunkImportApplyConfiguration{}
+}
+
+// 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 *TrunkImportApplyConfiguration) WithID(value string) *TrunkImportApplyConfiguration {
+ 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 *TrunkImportApplyConfiguration) WithFilter(value *TrunkFilterApplyConfiguration) *TrunkImportApplyConfiguration {
+ b.Filter = value
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/trunkresourcespec.go b/pkg/clients/applyconfiguration/api/v1alpha1/trunkresourcespec.go
new file mode 100644
index 00000000..bc98141d
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/trunkresourcespec.go
@@ -0,0 +1,104 @@
+/*
+Copyright 2025 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"
+)
+
+// TrunkResourceSpecApplyConfiguration represents a declarative configuration of the TrunkResourceSpec type for use
+// with apply.
+type TrunkResourceSpecApplyConfiguration struct {
+ Name *apiv1alpha1.OpenStackName `json:"name,omitempty"`
+ Description *apiv1alpha1.NeutronDescription `json:"description,omitempty"`
+ PortRef *apiv1alpha1.KubernetesNameRef `json:"portRef,omitempty"`
+ ProjectRef *apiv1alpha1.KubernetesNameRef `json:"projectRef,omitempty"`
+ AdminStateUp *bool `json:"adminStateUp,omitempty"`
+ Subports []TrunkSubportSpecApplyConfiguration `json:"subports,omitempty"`
+ Tags []apiv1alpha1.NeutronTag `json:"tags,omitempty"`
+}
+
+// TrunkResourceSpecApplyConfiguration constructs a declarative configuration of the TrunkResourceSpec type for use with
+// apply.
+func TrunkResourceSpec() *TrunkResourceSpecApplyConfiguration {
+ return &TrunkResourceSpecApplyConfiguration{}
+}
+
+// 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 *TrunkResourceSpecApplyConfiguration) WithName(value apiv1alpha1.OpenStackName) *TrunkResourceSpecApplyConfiguration {
+ b.Name = &value
+ return b
+}
+
+// WithDescription sets the Description 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 Description field is set to the value of the last call.
+func (b *TrunkResourceSpecApplyConfiguration) WithDescription(value apiv1alpha1.NeutronDescription) *TrunkResourceSpecApplyConfiguration {
+ b.Description = &value
+ return b
+}
+
+// WithPortRef sets the PortRef 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 PortRef field is set to the value of the last call.
+func (b *TrunkResourceSpecApplyConfiguration) WithPortRef(value apiv1alpha1.KubernetesNameRef) *TrunkResourceSpecApplyConfiguration {
+ b.PortRef = &value
+ return b
+}
+
+// WithProjectRef sets the ProjectRef 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 ProjectRef field is set to the value of the last call.
+func (b *TrunkResourceSpecApplyConfiguration) WithProjectRef(value apiv1alpha1.KubernetesNameRef) *TrunkResourceSpecApplyConfiguration {
+ b.ProjectRef = &value
+ return b
+}
+
+// WithAdminStateUp sets the AdminStateUp 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 AdminStateUp field is set to the value of the last call.
+func (b *TrunkResourceSpecApplyConfiguration) WithAdminStateUp(value bool) *TrunkResourceSpecApplyConfiguration {
+ b.AdminStateUp = &value
+ return b
+}
+
+// WithSubports adds the given value to the Subports 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 Subports field.
+func (b *TrunkResourceSpecApplyConfiguration) WithSubports(values ...*TrunkSubportSpecApplyConfiguration) *TrunkResourceSpecApplyConfiguration {
+ for i := range values {
+ if values[i] == nil {
+ panic("nil value passed to WithSubports")
+ }
+ b.Subports = append(b.Subports, *values[i])
+ }
+ return b
+}
+
+// WithTags adds the given value to the Tags 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 Tags field.
+func (b *TrunkResourceSpecApplyConfiguration) WithTags(values ...apiv1alpha1.NeutronTag) *TrunkResourceSpecApplyConfiguration {
+ for i := range values {
+ b.Tags = append(b.Tags, values[i])
+ }
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/trunkresourcestatus.go b/pkg/clients/applyconfiguration/api/v1alpha1/trunkresourcestatus.go
new file mode 100644
index 00000000..18f50b6a
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/trunkresourcestatus.go
@@ -0,0 +1,147 @@
+/*
+Copyright 2025 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/apimachinery/pkg/apis/meta/v1"
+)
+
+// TrunkResourceStatusApplyConfiguration represents a declarative configuration of the TrunkResourceStatus type for use
+// with apply.
+type TrunkResourceStatusApplyConfiguration struct {
+ Name *string `json:"name,omitempty"`
+ Description *string `json:"description,omitempty"`
+ PortID *string `json:"portID,omitempty"`
+ ProjectID *string `json:"projectID,omitempty"`
+ TenantID *string `json:"tenantID,omitempty"`
+ Status *string `json:"status,omitempty"`
+ Tags []string `json:"tags,omitempty"`
+ NeutronStatusMetadataApplyConfiguration `json:",inline"`
+ AdminStateUp *bool `json:"adminStateUp,omitempty"`
+ Subports []TrunkSubportStatusApplyConfiguration `json:"subports,omitempty"`
+}
+
+// TrunkResourceStatusApplyConfiguration constructs a declarative configuration of the TrunkResourceStatus type for use with
+// apply.
+func TrunkResourceStatus() *TrunkResourceStatusApplyConfiguration {
+ return &TrunkResourceStatusApplyConfiguration{}
+}
+
+// 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 *TrunkResourceStatusApplyConfiguration) WithName(value string) *TrunkResourceStatusApplyConfiguration {
+ b.Name = &value
+ return b
+}
+
+// WithDescription sets the Description 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 Description field is set to the value of the last call.
+func (b *TrunkResourceStatusApplyConfiguration) WithDescription(value string) *TrunkResourceStatusApplyConfiguration {
+ b.Description = &value
+ return b
+}
+
+// WithPortID sets the PortID 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 PortID field is set to the value of the last call.
+func (b *TrunkResourceStatusApplyConfiguration) WithPortID(value string) *TrunkResourceStatusApplyConfiguration {
+ b.PortID = &value
+ return b
+}
+
+// WithProjectID sets the ProjectID 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 ProjectID field is set to the value of the last call.
+func (b *TrunkResourceStatusApplyConfiguration) WithProjectID(value string) *TrunkResourceStatusApplyConfiguration {
+ b.ProjectID = &value
+ return b
+}
+
+// WithTenantID sets the TenantID 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 TenantID field is set to the value of the last call.
+func (b *TrunkResourceStatusApplyConfiguration) WithTenantID(value string) *TrunkResourceStatusApplyConfiguration {
+ b.TenantID = &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 *TrunkResourceStatusApplyConfiguration) WithStatus(value string) *TrunkResourceStatusApplyConfiguration {
+ b.Status = &value
+ return b
+}
+
+// WithTags adds the given value to the Tags 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 Tags field.
+func (b *TrunkResourceStatusApplyConfiguration) WithTags(values ...string) *TrunkResourceStatusApplyConfiguration {
+ for i := range values {
+ b.Tags = append(b.Tags, values[i])
+ }
+ return b
+}
+
+// WithCreatedAt sets the CreatedAt 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 CreatedAt field is set to the value of the last call.
+func (b *TrunkResourceStatusApplyConfiguration) WithCreatedAt(value v1.Time) *TrunkResourceStatusApplyConfiguration {
+ b.NeutronStatusMetadataApplyConfiguration.CreatedAt = &value
+ return b
+}
+
+// WithUpdatedAt sets the UpdatedAt 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 UpdatedAt field is set to the value of the last call.
+func (b *TrunkResourceStatusApplyConfiguration) WithUpdatedAt(value v1.Time) *TrunkResourceStatusApplyConfiguration {
+ b.NeutronStatusMetadataApplyConfiguration.UpdatedAt = &value
+ return b
+}
+
+// WithRevisionNumber sets the RevisionNumber 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 RevisionNumber field is set to the value of the last call.
+func (b *TrunkResourceStatusApplyConfiguration) WithRevisionNumber(value int64) *TrunkResourceStatusApplyConfiguration {
+ b.NeutronStatusMetadataApplyConfiguration.RevisionNumber = &value
+ return b
+}
+
+// WithAdminStateUp sets the AdminStateUp 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 AdminStateUp field is set to the value of the last call.
+func (b *TrunkResourceStatusApplyConfiguration) WithAdminStateUp(value bool) *TrunkResourceStatusApplyConfiguration {
+ b.AdminStateUp = &value
+ return b
+}
+
+// WithSubports adds the given value to the Subports 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 Subports field.
+func (b *TrunkResourceStatusApplyConfiguration) WithSubports(values ...*TrunkSubportStatusApplyConfiguration) *TrunkResourceStatusApplyConfiguration {
+ for i := range values {
+ if values[i] == nil {
+ panic("nil value passed to WithSubports")
+ }
+ b.Subports = append(b.Subports, *values[i])
+ }
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/trunkspec.go b/pkg/clients/applyconfiguration/api/v1alpha1/trunkspec.go
new file mode 100644
index 00000000..2eaef790
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/trunkspec.go
@@ -0,0 +1,79 @@
+/*
+Copyright 2025 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"
+)
+
+// TrunkSpecApplyConfiguration represents a declarative configuration of the TrunkSpec type for use
+// with apply.
+type TrunkSpecApplyConfiguration struct {
+ Import *TrunkImportApplyConfiguration `json:"import,omitempty"`
+ Resource *TrunkResourceSpecApplyConfiguration `json:"resource,omitempty"`
+ ManagementPolicy *apiv1alpha1.ManagementPolicy `json:"managementPolicy,omitempty"`
+ ManagedOptions *ManagedOptionsApplyConfiguration `json:"managedOptions,omitempty"`
+ CloudCredentialsRef *CloudCredentialsReferenceApplyConfiguration `json:"cloudCredentialsRef,omitempty"`
+}
+
+// TrunkSpecApplyConfiguration constructs a declarative configuration of the TrunkSpec type for use with
+// apply.
+func TrunkSpec() *TrunkSpecApplyConfiguration {
+ return &TrunkSpecApplyConfiguration{}
+}
+
+// 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 *TrunkSpecApplyConfiguration) WithImport(value *TrunkImportApplyConfiguration) *TrunkSpecApplyConfiguration {
+ 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 *TrunkSpecApplyConfiguration) WithResource(value *TrunkResourceSpecApplyConfiguration) *TrunkSpecApplyConfiguration {
+ 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 *TrunkSpecApplyConfiguration) WithManagementPolicy(value apiv1alpha1.ManagementPolicy) *TrunkSpecApplyConfiguration {
+ 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 *TrunkSpecApplyConfiguration) WithManagedOptions(value *ManagedOptionsApplyConfiguration) *TrunkSpecApplyConfiguration {
+ 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 *TrunkSpecApplyConfiguration) WithCloudCredentialsRef(value *CloudCredentialsReferenceApplyConfiguration) *TrunkSpecApplyConfiguration {
+ b.CloudCredentialsRef = value
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/trunkstatus.go b/pkg/clients/applyconfiguration/api/v1alpha1/trunkstatus.go
new file mode 100644
index 00000000..ccf85550
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/trunkstatus.go
@@ -0,0 +1,66 @@
+/*
+Copyright 2025 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"
+)
+
+// TrunkStatusApplyConfiguration represents a declarative configuration of the TrunkStatus type for use
+// with apply.
+type TrunkStatusApplyConfiguration struct {
+ Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"`
+ ID *string `json:"id,omitempty"`
+ Resource *TrunkResourceStatusApplyConfiguration `json:"resource,omitempty"`
+}
+
+// TrunkStatusApplyConfiguration constructs a declarative configuration of the TrunkStatus type for use with
+// apply.
+func TrunkStatus() *TrunkStatusApplyConfiguration {
+ return &TrunkStatusApplyConfiguration{}
+}
+
+// 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 *TrunkStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *TrunkStatusApplyConfiguration {
+ 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 *TrunkStatusApplyConfiguration) WithID(value string) *TrunkStatusApplyConfiguration {
+ 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 *TrunkStatusApplyConfiguration) WithResource(value *TrunkResourceStatusApplyConfiguration) *TrunkStatusApplyConfiguration {
+ b.Resource = value
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/trunksubportspec.go b/pkg/clients/applyconfiguration/api/v1alpha1/trunksubportspec.go
new file mode 100644
index 00000000..129b156d
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/trunksubportspec.go
@@ -0,0 +1,61 @@
+/*
+Copyright 2025 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"
+)
+
+// TrunkSubportSpecApplyConfiguration represents a declarative configuration of the TrunkSubportSpec type for use
+// with apply.
+type TrunkSubportSpecApplyConfiguration struct {
+ PortRef *apiv1alpha1.KubernetesNameRef `json:"portRef,omitempty"`
+ SegmentationID *int32 `json:"segmentationID,omitempty"`
+ SegmentationType *string `json:"segmentationType,omitempty"`
+}
+
+// TrunkSubportSpecApplyConfiguration constructs a declarative configuration of the TrunkSubportSpec type for use with
+// apply.
+func TrunkSubportSpec() *TrunkSubportSpecApplyConfiguration {
+ return &TrunkSubportSpecApplyConfiguration{}
+}
+
+// WithPortRef sets the PortRef 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 PortRef field is set to the value of the last call.
+func (b *TrunkSubportSpecApplyConfiguration) WithPortRef(value apiv1alpha1.KubernetesNameRef) *TrunkSubportSpecApplyConfiguration {
+ b.PortRef = &value
+ return b
+}
+
+// WithSegmentationID sets the SegmentationID 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 SegmentationID field is set to the value of the last call.
+func (b *TrunkSubportSpecApplyConfiguration) WithSegmentationID(value int32) *TrunkSubportSpecApplyConfiguration {
+ b.SegmentationID = &value
+ return b
+}
+
+// WithSegmentationType sets the SegmentationType 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 SegmentationType field is set to the value of the last call.
+func (b *TrunkSubportSpecApplyConfiguration) WithSegmentationType(value string) *TrunkSubportSpecApplyConfiguration {
+ b.SegmentationType = &value
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/trunksubportstatus.go b/pkg/clients/applyconfiguration/api/v1alpha1/trunksubportstatus.go
new file mode 100644
index 00000000..cabc5057
--- /dev/null
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/trunksubportstatus.go
@@ -0,0 +1,57 @@
+/*
+Copyright 2025 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
+
+// TrunkSubportStatusApplyConfiguration represents a declarative configuration of the TrunkSubportStatus type for use
+// with apply.
+type TrunkSubportStatusApplyConfiguration struct {
+ PortID *string `json:"portID,omitempty"`
+ SegmentationID *int32 `json:"segmentationID,omitempty"`
+ SegmentationType *string `json:"segmentationType,omitempty"`
+}
+
+// TrunkSubportStatusApplyConfiguration constructs a declarative configuration of the TrunkSubportStatus type for use with
+// apply.
+func TrunkSubportStatus() *TrunkSubportStatusApplyConfiguration {
+ return &TrunkSubportStatusApplyConfiguration{}
+}
+
+// WithPortID sets the PortID 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 PortID field is set to the value of the last call.
+func (b *TrunkSubportStatusApplyConfiguration) WithPortID(value string) *TrunkSubportStatusApplyConfiguration {
+ b.PortID = &value
+ return b
+}
+
+// WithSegmentationID sets the SegmentationID 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 SegmentationID field is set to the value of the last call.
+func (b *TrunkSubportStatusApplyConfiguration) WithSegmentationID(value int32) *TrunkSubportStatusApplyConfiguration {
+ b.SegmentationID = &value
+ return b
+}
+
+// WithSegmentationType sets the SegmentationType 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 SegmentationType field is set to the value of the last call.
+func (b *TrunkSubportStatusApplyConfiguration) WithSegmentationType(value string) *TrunkSubportStatusApplyConfiguration {
+ b.SegmentationType = &value
+ return b
+}
diff --git a/pkg/clients/applyconfiguration/internal/internal.go b/pkg/clients/applyconfiguration/internal/internal.go
index 92ad4e79..047f9030 100644
--- a/pkg/clients/applyconfiguration/internal/internal.go
+++ b/pkg/clients/applyconfiguration/internal/internal.go
@@ -2849,6 +2849,219 @@ var schemaYAML = typed.YAMLObject(`types:
- name: resource
type:
namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.SubnetResourceStatus
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.Trunk
+ 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.TrunkSpec
+ default: {}
+ - name: status
+ type:
+ namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.TrunkStatus
+ default: {}
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.TrunkFilter
+ map:
+ fields:
+ - name: adminStateUp
+ type:
+ scalar: boolean
+ - name: description
+ type:
+ scalar: string
+ - name: name
+ type:
+ scalar: string
+ - name: notTags
+ type:
+ list:
+ elementType:
+ scalar: string
+ elementRelationship: associative
+ - name: notTagsAny
+ type:
+ list:
+ elementType:
+ scalar: string
+ elementRelationship: associative
+ - name: portRef
+ type:
+ scalar: string
+ - name: projectRef
+ type:
+ scalar: string
+ - name: status
+ type:
+ scalar: string
+ - name: tags
+ type:
+ list:
+ elementType:
+ scalar: string
+ elementRelationship: associative
+ - name: tagsAny
+ type:
+ list:
+ elementType:
+ scalar: string
+ elementRelationship: associative
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.TrunkImport
+ map:
+ fields:
+ - name: filter
+ type:
+ namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.TrunkFilter
+ - name: id
+ type:
+ scalar: string
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.TrunkResourceSpec
+ map:
+ fields:
+ - name: adminStateUp
+ type:
+ scalar: boolean
+ - name: description
+ type:
+ scalar: string
+ - name: name
+ type:
+ scalar: string
+ - name: portRef
+ type:
+ scalar: string
+ - name: projectRef
+ type:
+ scalar: string
+ - name: subports
+ type:
+ list:
+ elementType:
+ namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.TrunkSubportSpec
+ elementRelationship: atomic
+ - name: tags
+ type:
+ list:
+ elementType:
+ scalar: string
+ elementRelationship: associative
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.TrunkResourceStatus
+ map:
+ fields:
+ - name: adminStateUp
+ type:
+ scalar: boolean
+ - name: createdAt
+ type:
+ namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time
+ - name: description
+ type:
+ scalar: string
+ - name: name
+ type:
+ scalar: string
+ - name: portID
+ type:
+ scalar: string
+ - name: projectID
+ type:
+ scalar: string
+ - name: revisionNumber
+ type:
+ scalar: numeric
+ - name: status
+ type:
+ scalar: string
+ - name: subports
+ type:
+ list:
+ elementType:
+ namedType: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.TrunkSubportStatus
+ elementRelationship: atomic
+ - name: tags
+ type:
+ list:
+ elementType:
+ scalar: string
+ elementRelationship: atomic
+ - name: tenantID
+ type:
+ scalar: string
+ - name: updatedAt
+ type:
+ namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.TrunkSpec
+ 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.TrunkImport
+ - 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.TrunkResourceSpec
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.TrunkStatus
+ 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.TrunkResourceStatus
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.TrunkSubportSpec
+ map:
+ fields:
+ - name: portRef
+ type:
+ scalar: string
+ default: ""
+ - name: segmentationID
+ type:
+ scalar: numeric
+ default: 0
+ - name: segmentationType
+ type:
+ scalar: string
+ default: ""
+- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.TrunkSubportStatus
+ map:
+ fields:
+ - name: portID
+ type:
+ scalar: string
+ - name: segmentationID
+ type:
+ scalar: numeric
+ - name: segmentationType
+ type:
+ scalar: string
- name: com.github.k-orc.openstack-resource-controller.v2.api.v1alpha1.UserDataSpec
map:
fields:
diff --git a/pkg/clients/applyconfiguration/utils.go b/pkg/clients/applyconfiguration/utils.go
index e3166fef..94630c40 100644
--- a/pkg/clients/applyconfiguration/utils.go
+++ b/pkg/clients/applyconfiguration/utils.go
@@ -336,6 +336,24 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &apiv1alpha1.SubnetSpecApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("SubnetStatus"):
return &apiv1alpha1.SubnetStatusApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("Trunk"):
+ return &apiv1alpha1.TrunkApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("TrunkFilter"):
+ return &apiv1alpha1.TrunkFilterApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("TrunkImport"):
+ return &apiv1alpha1.TrunkImportApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("TrunkResourceSpec"):
+ return &apiv1alpha1.TrunkResourceSpecApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("TrunkResourceStatus"):
+ return &apiv1alpha1.TrunkResourceStatusApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("TrunkSpec"):
+ return &apiv1alpha1.TrunkSpecApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("TrunkStatus"):
+ return &apiv1alpha1.TrunkStatusApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("TrunkSubportSpec"):
+ return &apiv1alpha1.TrunkSubportSpecApplyConfiguration{}
+ case v1alpha1.SchemeGroupVersion.WithKind("TrunkSubportStatus"):
+ return &apiv1alpha1.TrunkSubportStatusApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("UserDataSpec"):
return &apiv1alpha1.UserDataSpecApplyConfiguration{}
case v1alpha1.SchemeGroupVersion.WithKind("Volume"):
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 4d2f93b0..d269b4c0 100644
--- a/pkg/clients/clientset/clientset/typed/api/v1alpha1/api_client.go
+++ b/pkg/clients/clientset/clientset/typed/api/v1alpha1/api_client.go
@@ -45,6 +45,7 @@ type OpenstackV1alpha1Interface interface {
ServerGroupsGetter
ServicesGetter
SubnetsGetter
+ TrunksGetter
VolumesGetter
VolumeTypesGetter
}
@@ -122,6 +123,10 @@ func (c *OpenstackV1alpha1Client) Subnets(namespace string) SubnetInterface {
return newSubnets(c, namespace)
}
+func (c *OpenstackV1alpha1Client) Trunks(namespace string) TrunkInterface {
+ return newTrunks(c, namespace)
+}
+
func (c *OpenstackV1alpha1Client) Volumes(namespace string) VolumeInterface {
return newVolumes(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 44feeb45..a59d50e5 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
@@ -96,6 +96,10 @@ func (c *FakeOpenstackV1alpha1) Subnets(namespace string) v1alpha1.SubnetInterfa
return newFakeSubnets(c, namespace)
}
+func (c *FakeOpenstackV1alpha1) Trunks(namespace string) v1alpha1.TrunkInterface {
+ return newFakeTrunks(c, namespace)
+}
+
func (c *FakeOpenstackV1alpha1) Volumes(namespace string) v1alpha1.VolumeInterface {
return newFakeVolumes(c, namespace)
}
diff --git a/pkg/clients/clientset/clientset/typed/api/v1alpha1/fake/fake_trunk.go b/pkg/clients/clientset/clientset/typed/api/v1alpha1/fake/fake_trunk.go
new file mode 100644
index 00000000..c66994f9
--- /dev/null
+++ b/pkg/clients/clientset/clientset/typed/api/v1alpha1/fake/fake_trunk.go
@@ -0,0 +1,49 @@
+/*
+Copyright 2025 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"
+)
+
+// fakeTrunks implements TrunkInterface
+type fakeTrunks struct {
+ *gentype.FakeClientWithListAndApply[*v1alpha1.Trunk, *v1alpha1.TrunkList, *apiv1alpha1.TrunkApplyConfiguration]
+ Fake *FakeOpenstackV1alpha1
+}
+
+func newFakeTrunks(fake *FakeOpenstackV1alpha1, namespace string) typedapiv1alpha1.TrunkInterface {
+ return &fakeTrunks{
+ gentype.NewFakeClientWithListAndApply[*v1alpha1.Trunk, *v1alpha1.TrunkList, *apiv1alpha1.TrunkApplyConfiguration](
+ fake.Fake,
+ namespace,
+ v1alpha1.SchemeGroupVersion.WithResource("trunks"),
+ v1alpha1.SchemeGroupVersion.WithKind("Trunk"),
+ func() *v1alpha1.Trunk { return &v1alpha1.Trunk{} },
+ func() *v1alpha1.TrunkList { return &v1alpha1.TrunkList{} },
+ func(dst, src *v1alpha1.TrunkList) { dst.ListMeta = src.ListMeta },
+ func(list *v1alpha1.TrunkList) []*v1alpha1.Trunk { return gentype.ToPointerSlice(list.Items) },
+ func(list *v1alpha1.TrunkList, items []*v1alpha1.Trunk) { 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 56550a99..026081a5 100644
--- a/pkg/clients/clientset/clientset/typed/api/v1alpha1/generated_expansion.go
+++ b/pkg/clients/clientset/clientset/typed/api/v1alpha1/generated_expansion.go
@@ -52,6 +52,8 @@ type ServiceExpansion interface{}
type SubnetExpansion interface{}
+type TrunkExpansion interface{}
+
type VolumeExpansion interface{}
type VolumeTypeExpansion interface{}
diff --git a/pkg/clients/clientset/clientset/typed/api/v1alpha1/trunk.go b/pkg/clients/clientset/clientset/typed/api/v1alpha1/trunk.go
new file mode 100644
index 00000000..48c8406b
--- /dev/null
+++ b/pkg/clients/clientset/clientset/typed/api/v1alpha1/trunk.go
@@ -0,0 +1,74 @@
+/*
+Copyright 2025 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"
+)
+
+// TrunksGetter has a method to return a TrunkInterface.
+// A group's client should implement this interface.
+type TrunksGetter interface {
+ Trunks(namespace string) TrunkInterface
+}
+
+// TrunkInterface has methods to work with Trunk resources.
+type TrunkInterface interface {
+ Create(ctx context.Context, trunk *apiv1alpha1.Trunk, opts v1.CreateOptions) (*apiv1alpha1.Trunk, error)
+ Update(ctx context.Context, trunk *apiv1alpha1.Trunk, opts v1.UpdateOptions) (*apiv1alpha1.Trunk, error)
+ // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+ UpdateStatus(ctx context.Context, trunk *apiv1alpha1.Trunk, opts v1.UpdateOptions) (*apiv1alpha1.Trunk, 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.Trunk, error)
+ List(ctx context.Context, opts v1.ListOptions) (*apiv1alpha1.TrunkList, 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.Trunk, err error)
+ Apply(ctx context.Context, trunk *applyconfigurationapiv1alpha1.TrunkApplyConfiguration, opts v1.ApplyOptions) (result *apiv1alpha1.Trunk, err error)
+ // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
+ ApplyStatus(ctx context.Context, trunk *applyconfigurationapiv1alpha1.TrunkApplyConfiguration, opts v1.ApplyOptions) (result *apiv1alpha1.Trunk, err error)
+ TrunkExpansion
+}
+
+// trunks implements TrunkInterface
+type trunks struct {
+ *gentype.ClientWithListAndApply[*apiv1alpha1.Trunk, *apiv1alpha1.TrunkList, *applyconfigurationapiv1alpha1.TrunkApplyConfiguration]
+}
+
+// newTrunks returns a Trunks
+func newTrunks(c *OpenstackV1alpha1Client, namespace string) *trunks {
+ return &trunks{
+ gentype.NewClientWithListAndApply[*apiv1alpha1.Trunk, *apiv1alpha1.TrunkList, *applyconfigurationapiv1alpha1.TrunkApplyConfiguration](
+ "trunks",
+ c.RESTClient(),
+ scheme.ParameterCodec,
+ namespace,
+ func() *apiv1alpha1.Trunk { return &apiv1alpha1.Trunk{} },
+ func() *apiv1alpha1.TrunkList { return &apiv1alpha1.TrunkList{} },
+ ),
+ }
+}
diff --git a/pkg/clients/informers/externalversions/api/v1alpha1/interface.go b/pkg/clients/informers/externalversions/api/v1alpha1/interface.go
index 1b449781..c4c4d137 100644
--- a/pkg/clients/informers/externalversions/api/v1alpha1/interface.go
+++ b/pkg/clients/informers/externalversions/api/v1alpha1/interface.go
@@ -58,6 +58,8 @@ type Interface interface {
Services() ServiceInformer
// Subnets returns a SubnetInformer.
Subnets() SubnetInformer
+ // Trunks returns a TrunkInformer.
+ Trunks() TrunkInformer
// Volumes returns a VolumeInformer.
Volumes() VolumeInformer
// VolumeTypes returns a VolumeTypeInformer.
@@ -160,6 +162,11 @@ func (v *version) Subnets() SubnetInformer {
return &subnetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
+// Trunks returns a TrunkInformer.
+func (v *version) Trunks() TrunkInformer {
+ return &trunkInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
+}
+
// Volumes returns a VolumeInformer.
func (v *version) Volumes() VolumeInformer {
return &volumeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
diff --git a/pkg/clients/informers/externalversions/api/v1alpha1/trunk.go b/pkg/clients/informers/externalversions/api/v1alpha1/trunk.go
new file mode 100644
index 00000000..a0c0a293
--- /dev/null
+++ b/pkg/clients/informers/externalversions/api/v1alpha1/trunk.go
@@ -0,0 +1,102 @@
+/*
+Copyright 2025 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"
+)
+
+// TrunkInformer provides access to a shared informer and lister for
+// Trunks.
+type TrunkInformer interface {
+ Informer() cache.SharedIndexInformer
+ Lister() apiv1alpha1.TrunkLister
+}
+
+type trunkInformer struct {
+ factory internalinterfaces.SharedInformerFactory
+ tweakListOptions internalinterfaces.TweakListOptionsFunc
+ namespace string
+}
+
+// NewTrunkInformer constructs a new informer for Trunk 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 NewTrunkInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
+ return NewFilteredTrunkInformer(client, namespace, resyncPeriod, indexers, nil)
+}
+
+// NewFilteredTrunkInformer constructs a new informer for Trunk 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 NewFilteredTrunkInformer(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().Trunks(namespace).List(context.Background(), options)
+ },
+ WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.OpenstackV1alpha1().Trunks(namespace).Watch(context.Background(), options)
+ },
+ ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.OpenstackV1alpha1().Trunks(namespace).List(ctx, options)
+ },
+ WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.OpenstackV1alpha1().Trunks(namespace).Watch(ctx, options)
+ },
+ },
+ &v2apiv1alpha1.Trunk{},
+ resyncPeriod,
+ indexers,
+ )
+}
+
+func (f *trunkInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
+ return NewFilteredTrunkInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
+}
+
+func (f *trunkInformer) Informer() cache.SharedIndexInformer {
+ return f.factory.InformerFor(&v2apiv1alpha1.Trunk{}, f.defaultInformer)
+}
+
+func (f *trunkInformer) Lister() apiv1alpha1.TrunkLister {
+ return apiv1alpha1.NewTrunkLister(f.Informer().GetIndexer())
+}
diff --git a/pkg/clients/informers/externalversions/generic.go b/pkg/clients/informers/externalversions/generic.go
index 30911d11..a61f25af 100644
--- a/pkg/clients/informers/externalversions/generic.go
+++ b/pkg/clients/informers/externalversions/generic.go
@@ -87,6 +87,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Openstack().V1alpha1().Services().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("subnets"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Openstack().V1alpha1().Subnets().Informer()}, nil
+ case v1alpha1.SchemeGroupVersion.WithResource("trunks"):
+ return &genericInformer{resource: resource.GroupResource(), informer: f.Openstack().V1alpha1().Trunks().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("volumes"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Openstack().V1alpha1().Volumes().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("volumetypes"):
diff --git a/pkg/clients/listers/api/v1alpha1/expansion_generated.go b/pkg/clients/listers/api/v1alpha1/expansion_generated.go
index ba288873..a46ae338 100644
--- a/pkg/clients/listers/api/v1alpha1/expansion_generated.go
+++ b/pkg/clients/listers/api/v1alpha1/expansion_generated.go
@@ -154,6 +154,14 @@ type SubnetListerExpansion interface{}
// SubnetNamespaceLister.
type SubnetNamespaceListerExpansion interface{}
+// TrunkListerExpansion allows custom methods to be added to
+// TrunkLister.
+type TrunkListerExpansion interface{}
+
+// TrunkNamespaceListerExpansion allows custom methods to be added to
+// TrunkNamespaceLister.
+type TrunkNamespaceListerExpansion interface{}
+
// VolumeListerExpansion allows custom methods to be added to
// VolumeLister.
type VolumeListerExpansion interface{}
diff --git a/pkg/clients/listers/api/v1alpha1/trunk.go b/pkg/clients/listers/api/v1alpha1/trunk.go
new file mode 100644
index 00000000..6dd67834
--- /dev/null
+++ b/pkg/clients/listers/api/v1alpha1/trunk.go
@@ -0,0 +1,70 @@
+/*
+Copyright 2025 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"
+)
+
+// TrunkLister helps list Trunks.
+// All objects returned here must be treated as read-only.
+type TrunkLister interface {
+ // List lists all Trunks in the indexer.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*apiv1alpha1.Trunk, err error)
+ // Trunks returns an object that can list and get Trunks.
+ Trunks(namespace string) TrunkNamespaceLister
+ TrunkListerExpansion
+}
+
+// trunkLister implements the TrunkLister interface.
+type trunkLister struct {
+ listers.ResourceIndexer[*apiv1alpha1.Trunk]
+}
+
+// NewTrunkLister returns a new TrunkLister.
+func NewTrunkLister(indexer cache.Indexer) TrunkLister {
+ return &trunkLister{listers.New[*apiv1alpha1.Trunk](indexer, apiv1alpha1.Resource("trunk"))}
+}
+
+// Trunks returns an object that can list and get Trunks.
+func (s *trunkLister) Trunks(namespace string) TrunkNamespaceLister {
+ return trunkNamespaceLister{listers.NewNamespaced[*apiv1alpha1.Trunk](s.ResourceIndexer, namespace)}
+}
+
+// TrunkNamespaceLister helps list and get Trunks.
+// All objects returned here must be treated as read-only.
+type TrunkNamespaceLister interface {
+ // List lists all Trunks in the indexer for a given namespace.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*apiv1alpha1.Trunk, err error)
+ // Get retrieves the Trunk from the indexer for a given namespace and name.
+ // Objects returned here must be treated as read-only.
+ Get(name string) (*apiv1alpha1.Trunk, error)
+ TrunkNamespaceListerExpansion
+}
+
+// trunkNamespaceLister implements the TrunkNamespaceLister
+// interface.
+type trunkNamespaceLister struct {
+ listers.ResourceIndexer[*apiv1alpha1.Trunk]
+}
diff --git a/website/docs/crd-reference.md b/website/docs/crd-reference.md
index 36f357a3..2826fb16 100644
--- a/website/docs/crd-reference.md
+++ b/website/docs/crd-reference.md
@@ -27,6 +27,7 @@ Package v1alpha1 contains API Schema definitions for the openstack v1alpha1 API
- [ServerGroup](#servergroup)
- [Service](#service)
- [Subnet](#subnet)
+- [Trunk](#trunk)
- [Volume](#volume)
- [VolumeType](#volumetype)
@@ -179,6 +180,7 @@ _Appears in:_
- [ServerSpec](#serverspec)
- [ServiceSpec](#servicespec)
- [SubnetSpec](#subnetspec)
+- [TrunkSpec](#trunkspec)
- [VolumeSpec](#volumespec)
- [VolumeTypeSpec](#volumetypespec)
@@ -419,6 +421,7 @@ _Appears in:_
- [RouterFilter](#routerfilter)
- [SecurityGroupFilter](#securitygroupfilter)
- [SubnetFilter](#subnetfilter)
+- [TrunkFilter](#trunkfilter)
| Field | Description | Default | Validation |
| --- | --- | --- | --- |
@@ -1632,6 +1635,9 @@ _Appears in:_
- [ServerVolumeSpec](#servervolumespec)
- [SubnetFilter](#subnetfilter)
- [SubnetResourceSpec](#subnetresourcespec)
+- [TrunkFilter](#trunkfilter)
+- [TrunkResourceSpec](#trunkresourcespec)
+- [TrunkSubportSpec](#trunksubportspec)
- [UserDataSpec](#userdataspec)
- [VolumeResourceSpec](#volumeresourcespec)
@@ -1692,6 +1698,7 @@ _Appears in:_
- [ServerSpec](#serverspec)
- [ServiceSpec](#servicespec)
- [SubnetSpec](#subnetspec)
+- [TrunkSpec](#trunkspec)
- [VolumeSpec](#volumespec)
- [VolumeTypeSpec](#volumetypespec)
@@ -1726,6 +1733,7 @@ _Appears in:_
- [ServerSpec](#serverspec)
- [ServiceSpec](#servicespec)
- [SubnetSpec](#subnetspec)
+- [TrunkSpec](#trunkspec)
- [VolumeSpec](#volumespec)
- [VolumeTypeSpec](#volumetypespec)
@@ -1918,6 +1926,8 @@ _Appears in:_
- [SecurityGroupRule](#securitygrouprule)
- [SubnetFilter](#subnetfilter)
- [SubnetResourceSpec](#subnetresourcespec)
+- [TrunkFilter](#trunkfilter)
+- [TrunkResourceSpec](#trunkresourcespec)
@@ -1935,6 +1945,7 @@ _Appears in:_
- [PortResourceStatus](#portresourcestatus)
- [SecurityGroupResourceStatus](#securitygroupresourcestatus)
- [SubnetResourceStatus](#subnetresourcestatus)
+- [TrunkResourceStatus](#trunkresourcestatus)
| Field | Description | Default | Validation |
| --- | --- | --- | --- |
@@ -1968,6 +1979,8 @@ _Appears in:_
- [SecurityGroupResourceSpec](#securitygroupresourcespec)
- [SubnetFilter](#subnetfilter)
- [SubnetResourceSpec](#subnetresourcespec)
+- [TrunkFilter](#trunkfilter)
+- [TrunkResourceSpec](#trunkresourcespec)
@@ -2025,6 +2038,8 @@ _Appears in:_
- [ServiceResourceSpec](#serviceresourcespec)
- [SubnetFilter](#subnetfilter)
- [SubnetResourceSpec](#subnetresourcespec)
+- [TrunkFilter](#trunkfilter)
+- [TrunkResourceSpec](#trunkresourcespec)
- [VolumeFilter](#volumefilter)
- [VolumeResourceSpec](#volumeresourcespec)
- [VolumeTypeFilter](#volumetypefilter)
@@ -3777,6 +3792,196 @@ _Appears in:_
| `resource` _[SubnetResourceStatus](#subnetresourcestatus)_ | resource contains the observed state of the OpenStack resource. | | |
+#### Trunk
+
+
+
+Trunk is the Schema for an ORC resource.
+
+
+
+
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `apiVersion` _string_ | `openstack.k-orc.cloud/v1alpha1` | | |
+| `kind` _string_ | `Trunk` | | |
+| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
+| `spec` _[TrunkSpec](#trunkspec)_ | spec specifies the desired state of the resource. | | |
+| `status` _[TrunkStatus](#trunkstatus)_ | status defines the observed state of the resource. | | |
+
+
+#### TrunkFilter
+
+
+
+TrunkFilter defines an existing resource by its properties
+
+_Validation:_
+- MinProperties: 1
+
+_Appears in:_
+- [TrunkImport](#trunkimport)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `name` _[OpenStackName](#openstackname)_ | name of the existing resource | | MaxLength: 255
MinLength: 1
Pattern: `^[^,]+$`
|
+| `description` _[NeutronDescription](#neutrondescription)_ | description of the existing resource | | MaxLength: 255
MinLength: 1
|
+| `portRef` _[KubernetesNameRef](#kubernetesnameref)_ | portRef is a reference to the ORC Port which this resource is associated with. | | MaxLength: 253
MinLength: 1
|
+| `projectRef` _[KubernetesNameRef](#kubernetesnameref)_ | projectRef is a reference to the ORC Project which this resource is associated with. | | MaxLength: 253
MinLength: 1
|
+| `status` _string_ | status indicates whether the trunk is currently operational. Possible values include
`ACTIVE', `DOWN', `BUILD', `DEGRADED' or `ERROR'. Plug-ins might define additional values. | | |
+| `adminStateUp` _boolean_ | adminStateUp is the administrative state of the trunk. | | |
+| `tags` _[NeutronTag](#neutrontag) array_ | tags is a list of tags to filter by. If specified, the resource must
have all of the tags specified to be included in the result. | | MaxItems: 64
ListType: set
MaxLength: 255
MinLength: 1
|
+| `tagsAny` _[NeutronTag](#neutrontag) array_ | tagsAny is a list of tags to filter by. If specified, the resource
must have at least one of the tags specified to be included in the
result. | | MaxItems: 64
ListType: set
MaxLength: 255
MinLength: 1
|
+| `notTags` _[NeutronTag](#neutrontag) array_ | notTags is a list of tags to filter by. If specified, resources which
contain all of the given tags will be excluded from the result. | | MaxItems: 64
ListType: set
MaxLength: 255
MinLength: 1
|
+| `notTagsAny` _[NeutronTag](#neutrontag) array_ | notTagsAny is a list of tags to filter by. If specified, resources
which contain any of the given tags will be excluded from the result. | | MaxItems: 64
ListType: set
MaxLength: 255
MinLength: 1
|
+
+
+#### TrunkImport
+
+
+
+TrunkImport specifies an existing resource which will be imported instead of
+creating a new one
+
+_Validation:_
+- MaxProperties: 1
+- MinProperties: 1
+
+_Appears in:_
+- [TrunkSpec](#trunkspec)
+
+| 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
|
+| `filter` _[TrunkFilter](#trunkfilter)_ | 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
|
+
+
+#### TrunkResourceSpec
+
+
+
+TrunkResourceSpec contains the desired state of the resource.
+
+
+
+_Appears in:_
+- [TrunkSpec](#trunkspec)
+
+| 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: `^[^,]+$`
|
+| `description` _[NeutronDescription](#neutrondescription)_ | description is a human-readable description for the resource. | | MaxLength: 255
MinLength: 1
|
+| `portRef` _[KubernetesNameRef](#kubernetesnameref)_ | portRef is a reference to the ORC Port which this resource is associated with. | | MaxLength: 253
MinLength: 1
XValidation: rule="self == oldSelf",message="portRef is immutable"
|
+| `projectRef` _[KubernetesNameRef](#kubernetesnameref)_ | projectRef is a reference to the ORC Project which this resource is associated with. | | MaxLength: 253
MinLength: 1
XValidation: rule="self == oldSelf",message="projectRef is immutable"
|
+| `adminStateUp` _boolean_ | adminStateUp is the administrative state of the trunk. If false (down),
the trunk does not forward packets. | | |
+| `subports` _[TrunkSubportSpec](#trunksubportspec) array_ | subports is the list of ports to attach to the trunk.
NOTE: ORC currently does not implement reconcile logic for subport updates
(Neutron uses dedicated add/remove subport APIs). This field is immutable
until that behavior is implemented in the controller. | | MaxItems: 1024
ListType: atomic
XValidation: rule="self == oldSelf",message="subports is immutable"
|
+| `tags` _[NeutronTag](#neutrontag) array_ | tags is a list of Neutron tags to apply to the trunk.
NOTE: ORC does not currently reconcile tag updates for Trunk. | | MaxItems: 64
ListType: set
MaxLength: 255
MinLength: 1
XValidation: rule="self == oldSelf",message="tags is immutable"
|
+
+
+#### TrunkResourceStatus
+
+
+
+TrunkResourceStatus represents the observed state of the resource.
+
+
+
+_Appears in:_
+- [TrunkStatus](#trunkstatus)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `name` _string_ | name is a Human-readable name for the resource. Might not be unique. | | MaxLength: 1024
|
+| `description` _string_ | description is a human-readable description for the resource. | | MaxLength: 1024
|
+| `portID` _string_ | portID is the ID of the Port to which the resource is associated. | | MaxLength: 1024
|
+| `projectID` _string_ | projectID is the ID of the Project to which the resource is associated. | | MaxLength: 1024
|
+| `tenantID` _string_ | tenantID is the project owner of the trunk (alias of projectID in some deployments). | | MaxLength: 1024
|
+| `status` _string_ | status indicates whether the trunk is currently operational. | | MaxLength: 1024
|
+| `tags` _string array_ | tags is the list of tags on the resource. | | MaxItems: 64
ListType: atomic
items:MaxLength: 1024
|
+| `createdAt` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#time-v1-meta)_ | createdAt shows the date and time when the resource was created. The date and time stamp format is ISO 8601 | | |
+| `updatedAt` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#time-v1-meta)_ | updatedAt shows the date and time when the resource was updated. The date and time stamp format is ISO 8601 | | |
+| `revisionNumber` _integer_ | revisionNumber optionally set via extensions/standard-attr-revisions | | |
+| `adminStateUp` _boolean_ | adminStateUp is the administrative state of the trunk. | | |
+| `subports` _[TrunkSubportStatus](#trunksubportstatus) array_ | subports is a list of ports associated with the trunk. | | MaxItems: 1024
ListType: atomic
|
+
+
+#### TrunkSpec
+
+
+
+TrunkSpec defines the desired state of an ORC object.
+
+
+
+_Appears in:_
+- [Trunk](#trunk)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `import` _[TrunkImport](#trunkimport)_ | import refers to an existing OpenStack resource which will be imported instead of
creating a new one. | | MaxProperties: 1
MinProperties: 1
|
+| `resource` _[TrunkResourceSpec](#trunkresourcespec)_ | 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`. | | |
+| `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]
XValidation: rule="self == oldSelf",message="managementPolicy is immutable"
|
+| `managedOptions` _[ManagedOptions](#managedoptions)_ | managedOptions specifies options which may be applied to managed objects. | | |
+| `cloudCredentialsRef` _[CloudCredentialsReference](#cloudcredentialsreference)_ | cloudCredentialsRef points to a secret containing OpenStack credentials | | |
+
+
+#### TrunkStatus
+
+
+
+TrunkStatus defines the observed state of an ORC resource.
+
+
+
+_Appears in:_
+- [Trunk](#trunk)
+
+| 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
ListType: map
ListMapKey: type
PatchStrategy: merge
PatchMergeKey: type
|
+| `id` _string_ | id is the unique identifier of the OpenStack resource. | | |
+| `resource` _[TrunkResourceStatus](#trunkresourcestatus)_ | resource contains the observed state of the OpenStack resource. | | |
+
+
+#### TrunkSubportSpec
+
+
+
+TrunkSubportSpec represents a subport to attach to a trunk.
+It maps to gophercloud's trunks.Subport.
+
+
+
+_Appears in:_
+- [TrunkResourceSpec](#trunkresourcespec)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `portRef` _[KubernetesNameRef](#kubernetesnameref)_ | portRef is a reference to the ORC Port that will be attached as a subport. | | MaxLength: 253
MinLength: 1
|
+| `segmentationID` _integer_ | segmentationID is the segmentation ID for the subport (e.g. VLAN ID). | | Maximum: 4094
Minimum: 1
|
+| `segmentationType` _string_ | segmentationType is the segmentation type for the subport (e.g. vlan). | | MaxLength: 255
MinLength: 1
|
+
+
+#### TrunkSubportStatus
+
+
+
+TrunkSubportStatus represents an attached subport on a trunk.
+It maps to gophercloud's trunks.Subport.
+
+
+
+_Appears in:_
+- [TrunkResourceStatus](#trunkresourcestatus)
+
+| Field | Description | Default | Validation |
+| --- | --- | --- | --- |
+| `portID` _string_ | portID is the OpenStack ID of the Port attached as a subport. | | MaxLength: 1024
|
+| `segmentationID` _integer_ | segmentationID is the segmentation ID for the subport (e.g. VLAN ID). | | |
+| `segmentationType` _string_ | segmentationType is the segmentation type for the subport (e.g. vlan). | | MaxLength: 1024
|
+
+
#### UserDataSpec
diff --git a/website/docs/development/writing-tests.md b/website/docs/development/writing-tests.md
index 0f8c0ccb..0beeca6d 100644
--- a/website/docs/development/writing-tests.md
+++ b/website/docs/development/writing-tests.md
@@ -36,7 +36,7 @@ can specify modules that you want to test by passing the package's path,
separated by a blank space, for example:
```bash
-TEST_PATHS="./internal/controller/server ./internal/controller/image" make test
+TEST_PATHS="./internal/controllers/server ./internal/controllers/image" make test
```
## E2E tests