✨ Make allowedAddressPairs on OpenStackMachine ports mutable#3056
✨ Make allowedAddressPairs on OpenStackMachine ports mutable#3056jfpucheu wants to merge 4 commits intokubernetes-sigs:mainfrom
Conversation
✅ Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[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 |
|
Welcome @jfpucheu! |
|
Hi @jfpucheu. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. 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. |
|
This is my first PR. I have not been able to test on a multi-AZ environment as I only have a single-AZ DevStack setup available." |
456b330 to
5880143
Compare
|
/easycla |
5880143 to
04296a3
Compare
|
/ok-to-test |
|
/retitle ✨ Make allowedAddressPairs on OpenStackMachine ports mutable |
|
The CI failures are not related to this PR. The flatcar test timed out waiting for the control plane to become ready (infrastructure issue), which cascaded into the other failures. Our changes only affect allowedAddressPairs handling and have no impact on the flatcar bootstrap path. |
587bae3 to
327728a
Compare
Neutron ports support updating allowedAddressPairs without recreating the server. This change allows operators to update allowedAddressPairs on existing machines by patching the OpenStackMachineTemplate, without triggering a rolling replacement of the nodes. Changes: - OpenStackMachineTemplate webhook: exclude allowedAddressPairs from the immutability check so the field can be updated in-place. - OpenStackMachine webhook: same exclusion to allow the controller to annotate OSMs without being rejected. - OpenStackMachine controller: deep-copy ports before mutation to avoid corrupting the original spec through shared slice backing arrays, which would trigger the spec-immutability webhook. - Networking service: add UpdateAllowedAddressPairs() to call ports.Update on the Neutron API. - OpenStackMachineTemplate controller: add reconcileAllowedAddressPairs which walks MachineSets → Machines → OpenStackMachines → OpenStackServers and calls UpdateAllowedAddressPairs() for each provisioned port. Idempotency is tracked via an annotation on each OpenStackMachine so only a metadata-only patch is needed, avoiding the spec-immutability webhook entirely. - RBAC: add machinesets/machines/openstackmachines get/list/watch/patch permissions to the OSMT controller. - Unit tests for reconcileAllowedAddressPairs. - E2E test: creates a cluster with 1 CP and 1 worker (via a dedicated MachineDeployment with an explicit port), then patches the OSMT three times to accumulate allowedAddressPairs and verifies via the Neutron API after each patch that the port is updated without server restart.
…dAddressPairs tests
- Move reconcileAllowedAddressPairs before imageID nil check so it is never skipped by the early return in reconcileNormal - Add missing RBAC marker for openstackservers (get;list;watch) - Add webhook test cases for allowedAddressPairs mutability: - changing only AAP is allowed - changing AAP + another field is rejected - adding a port is rejected - removing a port is rejected
327728a to
ad24391
Compare
|
will take a look today. |
|
@lentzi90 PTAL when you can. |
Summary
allowedAddressPairsfrom the immutability check so the field can be updated in-place without triggering a node rolling replacement.UpdateAllowedAddressPairs()to callports.Updateon the Neutron API.reconcileAllowedAddressPairswhich walks MachineSets → Machines → OpenStackMachines → OpenStackServers and callsUpdateAllowedAddressPairs()for each provisioned port. Port IDs are read fromOpenStackServer.Status.Resources.Ports. Idempotency is tracked via an annotation on each OpenStackMachine (infrastructure.cluster.x-k8s.io/osmt-allowed-address-pairs) so only a metadata-only patch is needed, avoiding the spec-immutability webhook entirely.machinesets,machines, andopenstackmachinesget/list/watch/patch permissions to the OSMT controller.reconcileAllowedAddressPairs.allowedAddressPairsand verifies via the Neutron API after each patch that the port is updated without server restart.Motivation
Neutron supports updating
allowedAddressPairson a port without recreating the server. Previously, any change to the OSMT spec (includingallowedAddressPairs) was rejected by the immutability webhook, forcing operators to recreate nodes to apply network policy changes. This PR enables live updates ofallowedAddressPairson existing machines.This feature is particularly useful in OpenStack environments without a LoadBalancer (e.g.
FlavorWithoutLB), where solutions like MetalLB or kube-vip are used to expose services via Virtual IPs (VIPs). These tools require adding VIP addresses to theallowedAddressPairsof the worker node ports so that OpenStack allows the traffic to pass through. Without this feature, operators had to recreate nodes every time a new VIP was added — defeating the purpose of in-cluster load balancing.Test plan
go test ./controllers/... ./pkg/webhooks/... ./pkg/cloud/services/networking/...E2E_GINKGO_FOCUS="allowedAddressPairs" make test-e2eallowedAddressPairsare updated without Nova server restart