cloud-provider-openstack icon indicating copy to clipboard operation
cloud-provider-openstack copied to clipboard

[octavia-lb] Add the logic to reattach the VIP to the load balancer if the IP has changed

Open yang-wang11 opened this issue 2 years ago • 17 comments

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.

yang-wang11 avatar Oct 24 '23 09:10 yang-wang11

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:

k8s-ci-robot avatar Oct 24 '23 09:10 k8s-ci-robot

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.

k8s-ci-robot avatar Oct 24 '23 09:10 k8s-ci-robot

/test all

yang-wang11 avatar Oct 24 '23 09:10 yang-wang11

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

k8s-ci-robot avatar Oct 24 '23 09:10 k8s-ci-robot

/ok-to-test

dulek avatar Oct 24 '23 11:10 dulek

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.

dulek avatar Oct 24 '23 17:10 dulek

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.

yang-wang11 avatar Oct 26 '23 07:10 yang-wang11

/retest

yang-wang11 avatar Oct 26 '23 12:10 yang-wang11

/assign @yang-wang11

yang-wang11 avatar Oct 30 '23 05:10 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.

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

k8s-ci-robot avatar Oct 30 '23 07:10 k8s-ci-robot

/test all

yang-wang11 avatar Oct 31 '23 10:10 yang-wang11

/retest

yang-wang11 avatar Nov 02 '23 12:11 yang-wang11

@kayrus I'm not trying to rush you, but kindly look forward to your code review.

yang-wang11 avatar Nov 06 '23 09:11 yang-wang11

@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?

kayrus avatar Nov 16 '23 16:11 kayrus

@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?

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

yang-wang11 avatar Nov 17 '23 04:11 yang-wang11

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.

k8s-ci-robot avatar Dec 01 '23 18:12 k8s-ci-robot

@yang-wang11 can you resolve the conflicts?

kayrus avatar Dec 11 '23 12:12 kayrus

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

k8s-triage-robot avatar Mar 10 '24 13:03 k8s-triage-robot

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

k8s-triage-robot avatar Apr 09 '24 13:04 k8s-triage-robot

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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 avatar May 09 '24 14:05 k8s-triage-robot

@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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

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.

k8s-ci-robot avatar May 09 '24 14:05 k8s-ci-robot