diff --git a/api/v1alpha1/trunk_types.go b/api/v1alpha1/trunk_types.go
index d857c4501..d39238e53 100644
--- a/api/v1alpha1/trunk_types.go
+++ b/api/v1alpha1/trunk_types.go
@@ -113,8 +113,10 @@ type TrunkFilter struct {
// +optional
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
- // Contrary to what the neutron doc say, we can't filter by status
- // https://github.com/gophercloud/gophercloud/issues/3626
+ // status indicates the trunk state to use as a filter.
+ // +kubebuilder:validation:MaxLength=64
+ // +optional
+ Status string `json:"status,omitempty"`
// adminStateUp is the administrative state of the trunk.
// +optional
diff --git a/cmd/models-schema/zz_generated.openapi.go b/cmd/models-schema/zz_generated.openapi.go
index 3642ebe37..0efe0902b 100644
--- a/cmd/models-schema/zz_generated.openapi.go
+++ b/cmd/models-schema/zz_generated.openapi.go
@@ -10643,6 +10643,13 @@ func schema_openstack_resource_controller_v2_api_v1alpha1_TrunkFilter(ref common
Format: "",
},
},
+ "status": {
+ SchemaProps: spec.SchemaProps{
+ Description: "status indicates the trunk state to use as a filter.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
"adminStateUp": {
SchemaProps: spec.SchemaProps{
Description: "adminStateUp is the administrative state of the trunk.",
diff --git a/config/crd/bases/openstack.k-orc.cloud_trunks.yaml b/config/crd/bases/openstack.k-orc.cloud_trunks.yaml
index aefa17223..d16693714 100644
--- a/config/crd/bases/openstack.k-orc.cloud_trunks.yaml
+++ b/config/crd/bases/openstack.k-orc.cloud_trunks.yaml
@@ -146,6 +146,11 @@ spec:
maxLength: 253
minLength: 1
type: string
+ status:
+ description: status indicates the trunk state to use as a
+ filter.
+ maxLength: 64
+ type: string
tags:
description: |-
tags is a list of tags to filter by. If specified, the resource must
diff --git a/internal/controllers/trunk/actuator.go b/internal/controllers/trunk/actuator.go
index 86cd107fb..addb21ffa 100644
--- a/internal/controllers/trunk/actuator.go
+++ b/internal/controllers/trunk/actuator.go
@@ -108,6 +108,7 @@ func (actuator trunkActuator) ListOSResourcesForImport(ctx context.Context, obj
PortID: ptr.Deref(port.Status.ID, ""),
ProjectID: ptr.Deref(project.Status.ID, ""),
AdminStateUp: filter.AdminStateUp,
+ Status: filter.Status,
Tags: tags.Join(filter.Tags),
TagsAny: tags.Join(filter.TagsAny),
NotTags: tags.Join(filter.NotTags),
diff --git a/internal/controllers/trunk/tests/trunk-import/00-import-resource.yaml b/internal/controllers/trunk/tests/trunk-import/00-import-resource.yaml
index 9bb9fa452..5d051741a 100644
--- a/internal/controllers/trunk/tests/trunk-import/00-import-resource.yaml
+++ b/internal/controllers/trunk/tests/trunk-import/00-import-resource.yaml
@@ -12,6 +12,7 @@ spec:
filter:
name: trunk-import-external
description: Trunk trunk-import-external from "trunk-import" test
+ status: ACTIVE
adminStateUp: true
tags:
- trunk-import-tag
diff --git a/pkg/clients/applyconfiguration/api/v1alpha1/trunkfilter.go b/pkg/clients/applyconfiguration/api/v1alpha1/trunkfilter.go
index e6efbaa32..3b7021cee 100644
--- a/pkg/clients/applyconfiguration/api/v1alpha1/trunkfilter.go
+++ b/pkg/clients/applyconfiguration/api/v1alpha1/trunkfilter.go
@@ -29,6 +29,7 @@ type TrunkFilterApplyConfiguration struct {
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"`
}
@@ -71,6 +72,14 @@ func (b *TrunkFilterApplyConfiguration) WithProjectRef(value apiv1alpha1.Kuberne
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.
diff --git a/pkg/clients/applyconfiguration/internal/internal.go b/pkg/clients/applyconfiguration/internal/internal.go
index 7a30ca985..0a3572b01 100644
--- a/pkg/clients/applyconfiguration/internal/internal.go
+++ b/pkg/clients/applyconfiguration/internal/internal.go
@@ -3199,6 +3199,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: projectRef
type:
scalar: string
+ - name: status
+ type:
+ scalar: string
- name: tags
type:
list:
diff --git a/website/docs/crd-reference.md b/website/docs/crd-reference.md
index 645c9cd3f..587f8214d 100644
--- a/website/docs/crd-reference.md
+++ b/website/docs/crd-reference.md
@@ -4194,6 +4194,7 @@ _Appears in:_
| `description` _[NeutronDescription](#neutrondescription)_ | description of the existing resource | | MaxLength: 255
MinLength: 1
Optional: \{\}
|
| `portRef` _[KubernetesNameRef](#kubernetesnameref)_ | portRef is a reference to the ORC Port which this resource is associated with. | | MaxLength: 253
MinLength: 1
Optional: \{\}
|
| `projectRef` _[KubernetesNameRef](#kubernetesnameref)_ | projectRef is a reference to the ORC Project which this resource is associated with. | | MaxLength: 253
MinLength: 1
Optional: \{\}
|
+| `status` _string_ | status indicates the trunk state to use as a filter. | | MaxLength: 64
Optional: \{\}
|
| `adminStateUp` _boolean_ | adminStateUp is the administrative state of the trunk. | | Optional: \{\}
|
| `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
MaxLength: 255
MinLength: 1
Optional: \{\}
|
| `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
MaxLength: 255
MinLength: 1
Optional: \{\}
|