Skip to content

Commit bdbcfa7

Browse files
committed
add filtering trunk resources by status
1 parent ec771ca commit bdbcfa7

8 files changed

Lines changed: 31 additions & 2 deletions

File tree

api/v1alpha1/trunk_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ type TrunkFilter struct {
113113
// +optional
114114
ProjectRef *KubernetesNameRef `json:"projectRef,omitempty"`
115115

116-
// Contrary to what the neutron doc say, we can't filter by status
117-
// https://github.com/gophercloud/gophercloud/issues/3626
116+
// status indicates the trunk state to use as a filter.
117+
// +kubebuilder:validation:MaxLength=64
118+
// +optional
119+
Status string `json:"status,omitempty"`
118120

119121
// adminStateUp is the administrative state of the trunk.
120122
// +optional

cmd/models-schema/zz_generated.openapi.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/openstack.k-orc.cloud_trunks.yaml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/controllers/trunk/actuator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ func (actuator trunkActuator) ListOSResourcesForImport(ctx context.Context, obj
137137
PortID: ptr.Deref(port.Status.ID, ""),
138138
ProjectID: ptr.Deref(project.Status.ID, ""),
139139
AdminStateUp: filter.AdminStateUp,
140+
Status: filter.Status,
140141
Tags: tags.Join(filter.Tags),
141142
TagsAny: tags.Join(filter.TagsAny),
142143
NotTags: tags.Join(filter.NotTags),

internal/controllers/trunk/tests/trunk-import/00-import-resource.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ spec:
1212
filter:
1313
name: trunk-import-external
1414
description: Trunk trunk-import-external from "trunk-import" test
15+
status: ACTIVE
1516
adminStateUp: true
1617
tags:
1718
- trunk-import-tag

pkg/clients/applyconfiguration/api/v1alpha1/trunkfilter.go

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/clients/applyconfiguration/internal/internal.go

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

website/docs/crd-reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4865,6 +4865,7 @@ _Appears in:_
48654865
| `description` _[NeutronDescription](#neutrondescription)_ | description of the existing resource | | MaxLength: 255 <br />MinLength: 1 <br />Optional: \{\} <br /> |
48664866
| `portRef` _[KubernetesNameRef](#kubernetesnameref)_ | portRef is a reference to the ORC Port which this resource is associated with. | | MaxLength: 253 <br />MinLength: 1 <br />Optional: \{\} <br /> |
48674867
| `projectRef` _[KubernetesNameRef](#kubernetesnameref)_ | projectRef is a reference to the ORC Project which this resource is associated with. | | MaxLength: 253 <br />MinLength: 1 <br />Optional: \{\} <br /> |
4868+
| `status` _string_ | status indicates the trunk state to use as a filter. | | MaxLength: 64 <br />Optional: \{\} <br /> |
48684869
| `adminStateUp` _boolean_ | adminStateUp is the administrative state of the trunk. | | Optional: \{\} <br /> |
48694870
| `tags` _[NeutronTag](#neutrontag) array_ | tags is a list of tags to filter by. If specified, the resource must<br />have all of the tags specified to be included in the result. | | MaxItems: 64 <br />MaxLength: 255 <br />MinLength: 1 <br />Optional: \{\} <br /> |
48704871
| `tagsAny` _[NeutronTag](#neutrontag) array_ | tagsAny is a list of tags to filter by. If specified, the resource<br />must have at least one of the tags specified to be included in the<br />result. | | MaxItems: 64 <br />MaxLength: 255 <br />MinLength: 1 <br />Optional: \{\} <br /> |

0 commit comments

Comments
 (0)