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

✨ Enable Worker Nodes to Associate with Floating IPs #1725

Closed
wants to merge 5 commits into from

Conversation

mikaelgron
Copy link
Contributor

What this PR does / why we need it:

This PR aims to enable worker nodes to associate with pre-allocated Floating IPs in OpenStack. The use-case is primarily for clients who want to whitelist their worker nodes in external services. By specifying a set of Floating IPs during the cluster setup, worker nodes can be configured to reuse these IPs, thus avoiding the need to track new floating IPs.

Note: This feature is currently in an experimental phase, and we are looking for feedback. It's not targeted to join alpha8 yet.

Future Steps

We're already contemplating further enhancements to add dynamicity to this feature. One idea is to allow the cluster CRD to dynamically create Floating IPs based on the number of machine deployments + X or something like that. While this isn't part of the current PR, it is a direction we're interested in exploring.

Feedback Requested
We are actively looking for feedback on this feature to understand its viability and possible improvements. Feel free to comment with your suggestions, questions, or concerns.

Special notes for your reviewer:

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • if necessary:
    • includes documentation
    • adds unit tests

/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 Oct 12, 2023
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 12, 2023

CLA Not Signed

@k8s-ci-robot
Copy link
Contributor

Welcome @mikaelgron!

It looks like this is your first PR to kubernetes-sigs/cluster-api-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-sigs/cluster-api-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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Oct 12, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @mikaelgron. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 12, 2023
@k8s-ci-robot k8s-ci-robot requested a review from jichenjc October 12, 2023 12:31
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mikaelgron
Once this PR has been reviewed and has the lgtm label, please assign neolit123 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

@netlify
Copy link

netlify bot commented Oct 12, 2023

Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!

Name Link
🔨 Latest commit 8da55ac
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/652d378c5c3a240008596206
😎 Deploy Preview https://deploy-preview-1725--kubernetes-sigs-cluster-api-openstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@dulek
Copy link
Contributor

dulek commented Oct 12, 2023

/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 Oct 12, 2023
}

if fp.PortID != "" {
scope.Logger().Info("Floating IP already associated to a port", "id", fp.ID, "fixedIP", fp.FixedIP, "portID", port.ID)
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels like something happening all the time, it should have lower log level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. It should perhaps be reduced on the APIServerLoadBalancer flow on line 426 as well.

return ctrl.Result{}, fmt.Errorf("associate floating IP %q to worker node with port %q: %w", fp.FloatingIP, port.ID, err)
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We should log a situation when node haven't got any FIP because pool got exhausted.

if !util.IsControlPlaneMachine(machine) && openStackCluster.Spec.WorkerFloatingIPConfig.Enabled {
scope.Logger().Info("Processing worker floating IPs")
for _, floatingIP := range openStackCluster.Spec.WorkerFloatingIPConfig.IPAddresses {
fp, err := networkingService.GetOrCreateFloatingIP(openStackMachine, openStackCluster, clusterName, floatingIP)
Copy link
Contributor

Choose a reason for hiding this comment

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

If FIP actually got created, where do we remove it on cluster deinstallation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the use case where you have to create IPs first to get the actual IP address strings to put in the spec, they would need to be removed manually anyway. It would be better to use a getter instead of a get-or-create in this case.

@@ -29,6 +29,11 @@ type ExternalRouterIPParam struct {
Subnet SubnetFilter `json:"subnet"`
}

type WorkerFloatingIPConfig struct {
Enabled bool `json:"enabled,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we even need this flag? Could a nil or empty list work as a disabled state?

Copy link
Contributor

@mdbooth mdbooth left a comment

Choose a reason for hiding this comment

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

Let me start with a negative: I'm not a fan of the design here, particularly that this would apply to all workers without any obvious mechanism for restricting it. It also touches floating IPs in the machine controller, which is already an almighty mess. I actually opened #1674 to track removing floatingIP from the machine spec because it can't be used correctly.

However, the use case you describe sounds interesting. I'd like to help you implement it.

This sounds like it could be an IPAM controller? I believe this was first implemented by metal3, so @lentzi90 may know more about it. How about we created an OpenStackFloatingIPPool. It could contain your pre-populated list of FIPs, or create them on demand. We could add floatingIP to PortOpts, except that instead of being an IP it would be a reference to an IPAM provider (in this case our OpenStackFloatingIPPool). The machine controller would create an IPClaim for the port and wait for an IPAddress to be allocated, at which point it could create the port.

The metal3 docs are here: https://book.metal3.io/ipam/introduction.html. There was talk of CAPI adopting it, and I understand CAPV are also using it.

controllers/openstackmachine_controller.go Outdated Show resolved Hide resolved
@jichenjc
Copy link
Contributor

/test pull-cluster-api-provider-openstack-test

@k8s-ci-robot
Copy link
Contributor

@mikaelgron: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-openstack-test 8da55ac link true /test pull-cluster-api-provider-openstack-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@k8s-triage-robot
Copy link

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-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 22, 2024
@dulek
Copy link
Contributor

dulek commented Jan 23, 2024

Looks like something being implemented by #1763?

@mdbooth
Copy link
Contributor

mdbooth commented Jan 30, 2024

Closed in favour of #1762

@mdbooth mdbooth closed this Jan 30, 2024
@huxcrux huxcrux deleted the worker-floating-ip branch March 9, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

7 participants