cloud-provider-openstack
cloud-provider-openstack copied to clipboard
[octavia-lb] Add the logic to reattach the VIP to the load balancer if the IP has changed
What this PR does / why we need it:
Which issue this PR fixes(if applicable): fixes #2443
Special notes for reviewers:
Release note:
Enable OCCM to reassign the new Floating IP from service.spec when spec.loadBalancerIP is changed.
Welcome @yang-wang11!
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. :smiley:
Hi @yang-wang11. 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.
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/test-infra repository.
/test all
@yang-wang11: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/test all
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/test-infra repository.
/ok-to-test
Seems like this also breaks shared LBs:
E1024 12:12:45.460335 11 controller.go:298] error processing service octavia-lb-test/test-shared-2 (retrying with exponential backoff): failed to ensure load balancer: floating IP is not available
I1024 12:12:45.460700 11 event.go:376] "Event occurred" object="octavia-lb-test/test-shared-2" fieldPath="" kind="Service" apiVersion="v1" type="Warning" reason="SyncLoadBalancerFailed" message="Error syncing load balancer: failed to ensure load balancer: floating IP is not available"
Not that I like the feature, but we cannot just break it.
I think this enables users of the cluster to set
spec.loadBalancerIP="", wait for a new FIP to get attached and repeat the process until all FIPs are exhausted. We shouldn't allow that. At minimum old FIP has to be deleted if it was created by the CPO.
@dulek Great observation, I will take some time to refactor this function to lessen the if-else.
/retest
/assign @yang-wang11
[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 zetaab for approval. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/test all
/retest
@kayrus I'm not trying to rush you, but kindly look forward to your code review.
@yang-wang11 Unfortunately I have doubts about the proposed ensureFloatingIP logic. I'm afraid the reconciliation port of the code is too fragile, and it requires a wider refactoring.
An example:
https://github.com/kubernetes/cloud-provider-openstack/blob/d6f294d0a0bdb53e2dd71023be007ef7b26d4834/pkg/openstack/loadbalancer.go#L965-L968
why would we fail in this case? What if the loadbalancer has a service.beta.kubernetes.io/openstack-internal-load-balancer flag? There is no indication that this loadbalancer is going to be updated, therefore there is no reason to return an error.
There are also a bunch of minor concerns, which combination in result raises other questions.
Basically this is the reason why the #2377 PR is still in draft.
IMO the first step that we need to perform is to extend the mock API with Octavia support and add test cases which include a collection of different annotation combinations for services.
@yang-wang11 how critical is the issue for you? Does it occur only on svc update only?
@yang-wang11 Unfortunately I have doubts about the proposed
ensureFloatingIPlogic. I'm afraid the reconciliation port of the code is too fragile, and it requires a wider refactoring.An example:
https://github.com/kubernetes/cloud-provider-openstack/blob/d6f294d0a0bdb53e2dd71023be007ef7b26d4834/pkg/openstack/loadbalancer.go#L965-L968
why would we fail in this case? What if the loadbalancer has a
service.beta.kubernetes.io/openstack-internal-load-balancerflag? There is no indication that this loadbalancer is going to be updated, therefore there is no reason to return an error.There are also a bunch of minor concerns, which combination in result raises other questions.
Basically this is the reason why the #2377 PR is still in draft.
IMO the first step that we need to perform is to extend the mock API with Octavia support and add test cases which include a collection of different annotation combinations for services.
@yang-wang11 how critical is the issue for you? Does it occur only on svc update only?
@kayrus I'm unsure if this change belongs to a refactor or not, the thing I did is combine similar logic. It aims to eliminate the if-else logic. As we discussed in the Slack channel, the issue that occurred from the cluster was the update case, but not sure if there are others. we hope we can fix this issue at the earliest convenience.
PR needs rebase.
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/test-infra repository.
@yang-wang11 can you resolve the conflicts?
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.
This bot triages PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the PR is closed
You can:
- Mark this PR as fresh with
/remove-lifecycle stale - Close this PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.
This bot triages PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the PR is closed
You can:
- Mark this PR as fresh with
/remove-lifecycle rotten - Close this PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the PR is closed
You can:
- Reopen this PR with
/reopen - Mark this PR as fresh with
/remove-lifecycle rotten - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close
@k8s-triage-robot: Closed this PR.
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied- After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied- After 30d of inactivity since
lifecycle/rottenwas applied, the PR is closedYou can:
- Reopen this PR with
/reopen- Mark this PR as fresh with
/remove-lifecycle rotten- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close
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.