Skip to content

Commit 1749c64

Browse files
committed
port: add propagationUplinkStatus field
1 parent c63e4a9 commit 1749c64

18 files changed

Lines changed: 123 additions & 33 deletions

File tree

.github/workflows/e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
with:
3939
enable_workaround_docker_io: 'false'
4040
branch: ${{ matrix.openstack_version }}
41-
enabled_services: "openstack-cli-server,neutron-trunk,neutron-port-trusted-vif"
41+
enabled_services: "openstack-cli-server,neutron-trunk,neutron-port-trusted-vif,neutron-uplink-status-propagation"
4242
conf_overrides: |
4343
enable_plugin neutron https://github.com/openstack/neutron ${{ matrix.openstack_version }}
4444

api/v1alpha1/port_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,15 @@ type PortResourceSpec struct {
244244
// +optional
245245
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="valueSpecs is immutable"
246246
ValueSpecs []PortValueSpec `json:"valueSpecs,omitempty"`
247+
248+
// propagateUplinkStatus represents the uplink status propagation of
249+
// the port.
250+
// The field is now immutable due to a limitation on
251+
// Dalmatian (2024.2) release, we should address this later.
252+
// https://github.com/k-orc/openstack-resource-controller/pull/641#discussion_r2905989136
253+
// +optional
254+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="propagateUplinkStatus is immutable"
255+
PropagateUplinkStatus *bool `json:"propagateUplinkStatus,omitempty"`
247256
}
248257

249258
type PortResourceStatus struct {

api/v1alpha1/zz_generated.deepcopy.go

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

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_ports.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,17 @@ spec:
377377
x-kubernetes-validations:
378378
- message: projectRef is immutable
379379
rule: self == oldSelf
380+
propagateUplinkStatus:
381+
description: |-
382+
propagateUplinkStatus represents the uplink status propagation of
383+
the port.
384+
The field is now immutable due to a limitation on
385+
Dalmatian (2024.2) release, we should address this later.
386+
https://github.com/k-orc/openstack-resource-controller/pull/641#discussion_r2905989136
387+
type: boolean
388+
x-kubernetes-validations:
389+
- message: propagateUplinkStatus is immutable
390+
rule: self == oldSelf
380391
securityGroupRefs:
381392
description: |-
382393
securityGroupRefs are references to the security groups associated

internal/controllers/port/actuator.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,14 @@ func (actuator portActuator) CreateResource(ctx context.Context, obj *orcv1alpha
249249
}
250250

251251
createOpts := ports.CreateOpts{
252-
NetworkID: *network.Status.ID,
253-
Name: getResourceName(obj),
254-
Description: string(ptr.Deref(resource.Description, "")),
255-
ProjectID: projectID,
256-
AdminStateUp: resource.AdminStateUp,
257-
MACAddress: resource.MACAddress,
258-
ValueSpecs: valueSpecs,
252+
NetworkID: *network.Status.ID,
253+
Name: getResourceName(obj),
254+
Description: string(ptr.Deref(resource.Description, "")),
255+
ProjectID: projectID,
256+
AdminStateUp: resource.AdminStateUp,
257+
MACAddress: resource.MACAddress,
258+
ValueSpecs: valueSpecs,
259+
PropagateUplinkStatus: resource.PropagateUplinkStatus,
259260
}
260261

261262
if len(resource.AllowedAddressPairs) > 0 {

internal/controllers/port/actuator_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ func TestHandleTrustedVIFUpdate(t *testing.T) {
462462
}
463463

464464
updateOpts := handlePortTrustedVIFUpdate(&ports.UpdateOpts{}, resource, osResource)
465-
466465
got, _ := needsUpdate(updateOpts)
467466
if got != tt.expectChange {
468467
t.Errorf("expected needsUpdate=%v, got %v", tt.expectChange, got)

internal/controllers/port/status.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ func (portStatusWriter) ApplyResourceStatus(log logr.Logger, osResource *osResou
6767
WithNetworkID(osResource.NetworkID).
6868
WithTags(osResource.Tags...).
6969
WithSecurityGroups(osResource.SecurityGroups...).
70-
WithPropagateUplinkStatus(osResource.PropagateUplinkStatus).
7170
WithVNICType(osResource.VNICType).
7271
WithPortSecurityEnabled(osResource.PortSecurityEnabled).
7372
WithRevisionNumber(int64(osResource.RevisionNumber)).
@@ -108,5 +107,9 @@ func (portStatusWriter) ApplyResourceStatus(log logr.Logger, osResource *osResou
108107
resourceStatus.WithTrustedVIF(*osResource.PortTrustedVIF)
109108
}
110109

110+
if osResource.PropagateUplinkStatusPtr != nil {
111+
resourceStatus.WithPropagateUplinkStatus(*osResource.PropagateUplinkStatusPtr)
112+
}
113+
111114
statusApply.WithResource(resourceStatus)
112115
}

internal/controllers/port/tests/port-create-full/00-create-resource.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,4 @@ spec:
8787
macAddress: fa:16:3e:23:fd:d7
8888
hostID:
8989
id: devstack
90+
propagateUplinkStatus: false

internal/controllers/port/tests/port-create-minimal/00-assert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ status:
88
name: port-create-minimal
99
adminStateUp: true
1010
portSecurityEnabled: true
11-
propagateUplinkStatus: false
11+
propagateUplinkStatus: true
1212
revisionNumber: 1
1313
status: DOWN
1414
vnicType: normal

0 commit comments

Comments
 (0)