Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[occm] pattern based subnet detection for loadbalancers #1375

Merged
merged 8 commits into from
Mar 10, 2021

Conversation

mandelsoft
Copy link
Contributor

@mandelsoft mandelsoft commented Jan 15, 2021

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

What this PR does / why we need it:

A floating IP for a loadbalancer is created on a subnet of a floating pool (specified by a network id of the provider network).
Such a subnet has a dedicated IP range (CIDR). Therefore it might happen, that the subnet runs out of IP addresses. To not disrupt the existing FIP users in such a case a new subnet can be added to the provider network. This one will potentially automatically be selected for new FIP creation if the creator does not explicitly specify the subnet id.

But this automated subnet selection makes only sense if all subnets configured for a provider network provide the same kind
of routing. In Openstack it is possible to configure subnets for the same provider network that feature different kinds of routing (for example public internet or company network). In such a scenario so far a dedicated subnet must be specified for the FIP creation of a loadbalancer. If this setting is not done via service annotation, but as configuration of the cloud controller manager it is not possible to transparently add new matching subnets to the provider network by an administrator which is then used for further FIP creation.

This PR provides support for a new configuration possibility to overcome this problem. Instead of a dedicated subnet id it is possible now to optionally configure a subnet name pattern (supporting the standard glob mechanism) or tags. For this configuration option all matching subnets of a provider network are tried to create a new FIP. The first one where the FIP creation succeeds is used.
This allows configuring subnets with similar names according to name patterns specific for the routing environment, so that FIPs can transparently be created for loadbalancers just by adding a subnet with a name matching the dedicated name pattern.

Special notes for reviewers:

Release note:

[openstack-cloud-controller-manager] Added support to use subnet name pattern and tag filtering for creating floating IP for the load balancer.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 15, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @mandelsoft!

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

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 15, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @mandelsoft. 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 k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 15, 2021
@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

Build succeeded.

@dkistner
Copy link

This PR intended to fix #1328

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jan 15, 2021

Build succeeded.

@lingxiankong
Copy link
Contributor

Thanks for proposing this PR.

First, I want to make sure that in your cloud, is normal user able to get subnets of an external network? I'm asking because in devstack (also in our cloud), that's not allowed.

@lingxiankong
Copy link
Contributor

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 16, 2021
@lingxiankong
Copy link
Contributor

Additionally, I still prefer to use subnet tag instead of a name pattern, as suggested in the issue.

@lingxiankong
Copy link
Contributor

This PR intended to fix #1328

Please add that info in the PR description.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 9, 2021

Build succeeded.

@lingxiankong
Copy link
Contributor

lingxiankong commented Mar 9, 2021

The job cloud-provider-openstack-acceptance-test-e2e-conformance-stable-branch-v1.18 may have some problem.

@k8s-ci-robot
Copy link
Contributor

@lingxiankong: The specified target(s) for /test were not found.
The following commands are available to trigger jobs:

  • /test pull-cloud-provider-openstack-check
  • /test pull-cloud-provider-openstack-test

Use /test all to run all jobs.

In response to this:

/test cloud-provider-openstack-acceptance-test-lb-octavia

The job cloud-provider-openstack-acceptance-test-e2e-conformance-stable-branch-v1.18 may have some problem.

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.

@lingxiankong
Copy link
Contributor

/test cloud-provider-openstack-acceptance-test-lb-octavia

@k8s-ci-robot
Copy link
Contributor

@lingxiankong: The specified target(s) for /test were not found.
The following commands are available to trigger jobs:

  • /test pull-cloud-provider-openstack-check
  • /test pull-cloud-provider-openstack-test

Use /test all to run all jobs.

In response to this:

/test cloud-provider-openstack-acceptance-test-lb-octavia

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.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 9, 2021

Build succeeded.

@lingxiankong
Copy link
Contributor

don't worry about cloud-provider-openstack-acceptance-test-e2e-conformance-stable-branch-v1.18 for now.

@lingxiankong lingxiankong changed the title openstack-cloud-controller-manager: pattern based subnet detection for loadbalancers [occm] pattern based subnet detection for loadbalancers Mar 9, 2021
@lingxiankong
Copy link
Contributor

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 9, 2021
@lingxiankong
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 9, 2021
@lingxiankong
Copy link
Contributor

/override openlab/cloud-provider-openstack-acceptance-test-e2e-conformance-stable-branch-v1.18

@k8s-ci-robot
Copy link
Contributor

@lingxiankong: Overrode contexts on behalf of lingxiankong: openlab/cloud-provider-openstack-acceptance-test-e2e-conformance-stable-branch-v1.18

In response to this:

/override openlab/cloud-provider-openstack-acceptance-test-e2e-conformance-stable-branch-v1.18

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.

@lingxiankong
Copy link
Contributor

Simplified the release note

@lingxiankong
Copy link
Contributor

/lgtm

I will probably do a follow up patch for some minor improvements.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 10, 2021
@dkistner
Copy link

Thank you @lingxiankong for reviewing this PR.
What's the next step? Can we merge it or is another review required?

@lingxiankong
Copy link
Contributor

We need review from another maintainer.

@dkistner
Copy link

@ramineni or @chrigl Can someone of you so kind and have look?

Copy link
Contributor

@ramineni ramineni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mandelsoft Thanks for the PR. Have minor suggestion inline.
Approving this, later could be improved in followup PRs
/approve

pkg/openstack/loadbalancer.go Show resolved Hide resolved
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ramineni

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

The pull request process is described 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 k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 10, 2021
@k8s-ci-robot k8s-ci-robot merged commit 9e668d9 into kubernetes:master Mar 10, 2021
powellchristoph pushed a commit to powellchristoph/cloud-provider-openstack that referenced this pull request Jan 19, 2022
)

* pattern based subnet detection for loadbalancers

* rework subnet detection to additionally support tags

* rework defaulting of network/subnet spec handling annotations

* support tag lists and REST api based tag filtering

* improve error handling

* incorporate requested changes

* rework subnet spec based filtering

* rework subnet filter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[occm] Wildcard floating ip subnet selection for LoadBalancer services
6 participants