feat(openstack): add disablePortSecurity to MachineDeployment spec#2043
feat(openstack): add disablePortSecurity to MachineDeployment spec#2043mvanhorn wants to merge 2 commits into
Conversation
Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @mvanhorn. Thanks for your PR. I'm waiting for a kubermatic member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/cc |
There was a problem hiding this comment.
Pull request overview
Adds an OpenStack-specific disablePortSecurity boolean to the MachineDeployment provider spec, enabling operators to disable Neutron port security (and clear security groups) on instance ports after creation—needed for routing-based CNIs (e.g., Cilium native routing) while keeping default behavior unchanged.
Changes:
- Extend OpenStack provider spec/config to include
disablePortSecurityand load it via the existing config-var resolver pattern. - After server creation, optionally wait for each attached port and update it to set
port_security_enabled=falseand clear security groups for all configured networks (multi-NIC aware). - Add a table test for config loading and document the new option in the example manifest.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/cloudprovider/openstack/types.go | Adds disablePortSecurity to the SDK RawConfig schema for provider specs. |
| pkg/cloudprovider/provider/openstack/provider.go | Loads the flag and applies Neutron port updates post-create across all attached networks. |
| pkg/cloudprovider/provider/openstack/provider_test.go | Adds config-loading test coverage for disablePortSecurity. |
| pkg/cloudprovider/provider/openstack/helper.go | Implements Neutron port update helper using the portsecurity extension. |
| examples/openstack-machinedeployment.yaml | Documents the new disablePortSecurity option for users. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if err := p.portReadinessWaiter(ctx, instanceLog, netClient, server.ID, networkID, cfg.InstanceReadyCheckPeriod, cfg.InstanceReadyCheckTimeout); err != nil { | ||
| instanceLog.Infow("Port for instance did not became active", zap.Error(err)) | ||
| } |
| # Optional. If true, disables OpenStack port security on the instance's | ||
| # network port (and clears its security groups). Required for routing-based | ||
| # CNIs such as Cilium native routing that need IP/MAC "spoofing". | ||
| disablePortSecurity: false |
|
/test all |
|
@mvanhorn thank for the PR! Looks good and solid! Please fix mentioned typos and I'll merge it. |
Summary
Adds a
disablePortSecurityboolean to the OpenStack MachineDeployment provider spec. When set totrue, the machine-controller disables port security on the instance's Neutron network ports after the instance comes up, and clears their security groups (OpenStack rejects security groups on a port with port security disabled). Default behavior is unchanged.Why this matters
Routing-based Kubernetes CNIs such as Cilium native routing rely on a node forwarding traffic for IP/MAC addresses other than the port's own. OpenStack port security blocks that traffic, so those CNIs cannot run on worker nodes unless port security is turned off on the instance ports. As described in #2012, the OpenStack provider had no way to do this, while cluster-api already exposes the equivalent setting. This change closes that gap so operators can provision routing-CNI-ready nodes directly from a MachineDeployment.
What this PR does / why we need it
DisablePortSecurity providerconfig.ConfigVarBoolfield onRawConfig, resolved intoConfig.DisablePortSecurityingetConfig, mirroring the existingtrustDevicePath/configDrivebool fields.port_security_enabled=false, clearing the port's security groups in the same call.networkslist, not just the primary one, so the setting also takes effect on multi-NIC machines.false, no port update is performed and port security stays enabled.Testing
go test ./pkg/cloudprovider/provider/openstack/...passes, including a new table test assertingdisablePortSecuritydefaults tofalseand resolves totruewhen set.go build,go vet, andgofmtare clean for the touched packages in both the main andsdkmodules.Which issue(s) this PR fixes:
Fixes #2012
What type of PR is this?
/kind feature
Special notes for your reviewer:
The field is documented in
examples/openstack-machinedeployment.yaml.Does this PR introduce a user-facing change? Then add your Release Note here:
Documentation: