Skip to content

Refactor/octavia loadbalancer - #3156

Open
yahor-kurachkin wants to merge 4 commits into
kubernetes:masterfrom
yahor-kurachkin:refactor/octavia-loadbalancer
Open

Refactor/octavia loadbalancer#3156
yahor-kurachkin wants to merge 4 commits into
kubernetes:masterfrom
yahor-kurachkin:refactor/octavia-loadbalancer

Conversation

@yahor-kurachkin

@yahor-kurachkin yahor-kurachkin commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
Refactors pkg/openstack/loadbalancer.go for readability and maintainability with no functional changes — extracting helpers, decomposing large functions, standardizing error handling, and adding docs. Split into four reviewable phase commits; all existing tests pass.

Which issue this PR fixes(if applicable):
#3076

Special notes for reviewers:

  • [phase1] extract helper functions — small helpers to remove duplication (serviceName, checkLoadBalancerActive, resolveLBConfig, setPreferredIPFamily, poolProtocol, listener-deletion helpers, isListenerOwnedByService).
  • [phase2] decompose large functions — break up the mega-functions (ensureOctaviaLoadBalancer, checkService, ensureFloatingIP, createOctaviaLoadBalancer, ensureLoadBalancerDeleted, deleteLoadBalancer, ensureOctaviaListener/Pool, checkServiceUpdate) into focused helpers
  • [phase3] standardize error handling — %w wrapping + errors.Is for sentinel checks, aligned error wording.
  • [phase4] add godoc comments, group into sections, a Test_poolProtocol unit test, and minor readability polish.

I think this file will eventually need to be split into several smaller files, and the current section organization may help with that.

Release note:

NONE

Extract serviceName, checkLoadBalancerActive, resolveLBConfig,
setPreferredIPFamily, poolProtocol, listener deletion helpers, and
isListenerOwnedByService to remove duplication.
Break down ensureOctaviaLoadBalancer, checkService, ensureFloatingIP,
createOctaviaLoadBalancer, ensureOctaviaListener/Pool,
ensureLoadBalancerDeleted, deleteLoadBalancer, and checkServiceUpdate
into focused helpers; convert getLoadBalancerByName/getSubnetIDForLB to methods.
Use %w error wrapping and errors.Is for sentinel checks; align error
message wording.
@kubernetes-prow kubernetes-prow Bot added release-note-none Denotes a PR that doesn't merit a release note. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 3, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

PR needs rebase.

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 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 Aug 3, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @yahor-kurachkin. 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 3, 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 August 3, 2026 14:22
@yahor-kurachkin

Copy link
Copy Markdown
Contributor Author

@kayrus I think it would be better if you reviewed this PR, since you have the most context around this task. I can reorganize the PR differently, for example by splitting it into smaller PRs. Let me know what would be easier for you to review.

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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant