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

✨ Adds IPAM support for floating ips in OpenStackMachine #1762

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

bilbobrovall
Copy link
Contributor

@bilbobrovall bilbobrovall commented Nov 29, 2023

What this PR does / why we need it:
Implements IPAM support for floating ips in OpenStackMachine

First part of #1750

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 Nov 29, 2023
Copy link

linux-foundation-easycla bot commented Nov 29, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: bilbobrovall / name: Bilbo Brovall (7dce82c)

Copy link

netlify bot commented Nov 29, 2023

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

Name Link
🔨 Latest commit 7dce82c
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/65f04ca7c791070008c27409
😎 Deploy Preview https://deploy-preview-1762--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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Nov 29, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @bilbobrovall!

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 the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 29, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @bilbobrovall. 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 29, 2023
@mdbooth
Copy link
Contributor

mdbooth commented Nov 30, 2023

/check-cla

@jichenjc
Copy link
Contributor

jichenjc commented Dec 1, 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 Dec 1, 2023
pkg/utils/names/names.go Outdated Show resolved Hide resolved
}

func (r *OpenStackMachineReconciler) reconcileDeleteFloatingAddressFromPool(scope scope.Scope, openStackMachine *infrav1.OpenStackMachine) error {
scope.Logger().Info("Reconciling floating IP claims delete")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think better to add more info e.g the machine's name in log

controllers/openstackmachine_controller.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Dec 3, 2023
@huxcrux
Copy link
Contributor

huxcrux commented Dec 6, 2023

/retest

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 7, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 11, 2023
@huxcrux
Copy link
Contributor

huxcrux commented Dec 11, 2023

/retest

1 similar comment
@bilbobrovall
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 15, 2023
Copy link
Contributor

@dulek dulek left a comment

Choose a reason for hiding this comment

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

Bunch of questions inline.

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

@MaysaMacedo MaysaMacedo left a comment

Choose a reason for hiding this comment

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

Nice work

config/rbac/role.yaml Outdated Show resolved Hide resolved
controllers/openstackmachine_controller.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 24, 2024
@bilbobrovall
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Mar 8, 2024
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 8, 2024
@huxcrux
Copy link
Contributor

huxcrux commented Mar 8, 2024

I think it is fine to add examples, and even better if we point out that the IPPool is still v1alpha1 🙂

I'll added som basic info to the book, maybe you could take a look and se if you think it's enough?

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.

Critical changes:

  • Update the missed json tag
  • Remove status field (or explain why we need it)

With that I think I'd merge this.

@@ -104,6 +105,23 @@ The following fields in `PortOpts` are renamed in order to keep them consistent
* `hostId` becomes `hostID`
* `allowedCidrs` becomes `allowedCIDRs`

#### Additon of floatingIPPoolRef
Copy link
Contributor

Choose a reason for hiding this comment

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

*Addition

#### Additon of floatingIPPoolRef

A new field, FloatingIPPoolRef, has been introduced. It is important to note that this feature requires the existence of an IPPool to operate seamlessly. This new field references an IPPool whice will be used for floating IP allocation.
In additon to this field an IPPool resource called `OpenStackFloatingIPPool` has been added. Please not that this resource is new and still in alpha meaning its more likely to contain bugs and change in the future.
Copy link
Contributor

Choose a reason for hiding this comment

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

*note

@@ -95,7 +95,7 @@ type OpenStackMachineSpec struct {
// to an IPAddressClaim. Once the IPAddressClaim is fulfilled, the FloatingIP
// will be assigned to the OpenStackMachine.
// +optional
FloatingAddressFromPoolRef *corev1.TypedLocalObjectReference `json:"floatingAddressFromPool,omitempty"`
FloatingIPPoolRef *corev1.TypedLocalObjectReference `json:"floatingAddressFromPool,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to update the json tag.

@@ -452,11 +611,32 @@ func (r *OpenStackMachineReconciler) reconcileNormal(ctx context.Context, scope
return ctrl.Result{}, nil
}

err = r.reconcileAPIServerLoadBalancer(scope, openStackCluster, openStackMachine, instanceStatus, instanceNS, clusterName)
Copy link
Contributor

Choose a reason for hiding this comment

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

Guessing this was to make gocyclo happy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, initially it was possible to pass by just keeping down additions to reconcileNormal but after having to remove a couple of lines after every rebase, I just gave myself some margins 🫣

@@ -107,6 +114,10 @@ type OpenStackMachineStatus struct {
// +optional
Ready bool `json:"ready"`

// FloatingAddressFromPoolReady is true when the FloatingIP is ready.
// +optional
FloatingAddressFromPoolReady *bool `json:"floatingAddressFromPoolReady,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need this because we set a Condition. Unless I've missed something important, please could you remove it?

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 8, 2024
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 8, 2024
@bilbobrovall
Copy link
Contributor Author

/hold cancel

@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 8, 2024
@bilbobrovall
Copy link
Contributor Author

Critical changes:

  • Update the missed json tag
  • Remove status field (or explain why we need it)

With that I think I'd merge this.

Should be fixed now

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 11, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 12, 2024
@dulek
Copy link
Contributor

dulek commented Mar 15, 2024

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bilbobrovall, mdbooth

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 15, 2024
@k8s-ci-robot k8s-ci-robot merged commit f6fb753 into kubernetes-sigs:main Mar 15, 2024
9 checks passed
@huxcrux huxcrux deleted the floating_ip_from_pool branch March 20, 2024 19:49
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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet