Skip to content

[occm] Rename listener when its pool already has the new cluster-name - #3283

Open
lbarrosby wants to merge 1 commit into
kubernetes:masterfrom
lbarrosby:occm-rename-listener-stale-pool
Open

lbarrosby wants to merge 1 commit into
kubernetes:masterfrom
lbarrosby:occm-rename-listener-stale-pool

Conversation

@lbarrosby

Copy link
Copy Markdown

What this PR does / why we need it:

renameLoadBalancer reuses the oldClusterName variable for the pool's cluster-name and then uses it to rename the listener. If the pool already carries the new cluster-name but the listener does not, the listener is "renamed" from the new cluster-name to itself and keeps the old name.

This happens when a previous rename attempt renamed the pool and then failed before updating the listener (for example a timeout waiting for the LB to go ACTIVE). On the next sync the listener still has the old cluster-name, the pool is skipped, the listener update is a no-op, and the load balancer itself is renamed at the end. After that lbHasOldClusterName returns false, so the listener is never fixed.

The fix keeps the pool's cluster-name in its own variable, so the listener is always renamed using the cluster-name parsed from its own name.

Which issue this PR fixes(if applicable):
N/A

Special notes for reviewers:

Added TestRenameLoadBalancerListenerWithRenamedPool, which runs renameLoadBalancer against an httptest server with a listener named listener_0_kube_service_old_namespace_name and a pool already named pool_0_kube_service_new_namespace_name. Before the fix the listener update is sent with the old name and the test fails; with the fix it gets listener_0_kube_service_new_namespace_name. go test ./pkg/openstack/ and golangci-lint run ./pkg/openstack/... pass.

This PR was written in part with the assistance of generative AI.

Release note:

[openstack-cloud-controller-manager] Fixed a listener keeping the old cluster-name after a cluster-name change when its pool had already been renamed.

renameLoadBalancer reused oldClusterName for the pool's cluster-name and
then passed it to replaceClusterName for the listener. When the pool was
already renamed, for example because a previous attempt failed right
after renaming the pool, the listener name was "renamed" from the new
cluster-name to itself and kept the old one. The load balancer was then
renamed and the listener was never fixed on later syncs.

Keep the pool's cluster-name in its own variable.

Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
@kubernetes-prow kubernetes-prow Bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Nov 6, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign anguslees for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow
kubernetes-prow Bot requested review from anguslees and zetaab November 6, 2026 04:06
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Welcome @lbarrosby!

It looks like this is your first PR to kubernetes/cloud-provider-openstack 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/cloud-provider-openstack has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 6, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @lbarrosby. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@kubernetes-prow kubernetes-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 6, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant