-
Notifications
You must be signed in to change notification settings - Fork 256
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
🐛 Better checks before creating Floating IPs #2261
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
✅ Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
/cc mdbooth |
I initially wanted to do some webhook to just disallow |
/test pull-cluster-api-provider-openstack-e2e-test |
/cherry-pick release-0.11 |
@EmilienM: once the present PR merges, I will cherry-pick it on top of In response to this:
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Any idea how far back we need to backport this? 0.11 at least.
I'll investigate. |
On this one I want an eye from @lentzi90. |
/cherry-pick release-0.10 |
@EmilienM: once the present PR merges, I will cherry-pick it on top of In response to this:
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially wanted to do some webhook to just disallow DisableExternalNetwork to be True without also setting DisableAPIServerFloatingIP to True but it's not backward compatible and sucks for our users
Sure not backwards compatible, but do you mean that it is actually possible to use that configuration? I'm thinking it is ok to break backwards compatibility if all it was doing was cause nil pointer exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Looks good, and no need for extra logging now that the webhook immediately tells the user what is wrong 🙂
New changes are detected. LGTM label has been removed. |
When a floating is created, we need to make sure that `OpenStackCluster.Spec.DisableExternalNetwork` is not set to `True`. Otherwise, we'll have a nil pointer error. * Add a check in `reconcileBastion` to check that external network is not disabled before creating the floating IP for the bastion. * Add a check in `reconcileControlPlaneEndpoint` and `reconcileAPIServerLoadBalancer` to check that external network is not disabled (alongside the DisableAPIServerFloatingIP check) before creating the floating IP for the API server endpoint. * Add a safeguard in `GetOrCreateFloatingIP` to return a proper error (instead of a nil pointer error) when `openStackCluster.Status.ExternalNetwork` is nil. * Add API CEL to check that when DisableExternalNetwork is set and true, the bastion (if defined) doesn't have a floating IP defined and also that disableAPIServerFloatingIP (when set) is not False.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with this, but as mentioned on slack, I have one concern.
Sorry I didn't think of it earlier.
Will the user ever be the one setting the floating IP? Or are we now just going to block the controller trying to add it?
yes, a user can set the FIP: cluster-api-provider-openstack/controllers/openstackcluster_controller.go Lines 422 to 424 in 5429b4b
|
What this PR does / why we need it:
When a floating is created, we need to make sure that
OpenStackCluster.Spec.DisableExternalNetwork
is not set toTrue
.Otherwise, we'll have a nil pointer error.
reconcileBastion
to check that external network isnot disabled before creating the floating IP for the bastion.
reconcileControlPlaneEndpoint
andreconcileAPIServerLoadBalancer
to check that externalnetwork is not disabled (alongside the DisableAPIServerFloatingIP
check) before creating the floating IP for the API server endpoint.
GetOrCreateFloatingIP
to return a proper error(instead of a nil pointer error) when
openStackCluster.Status.ExternalNetwork
is nil.the bastion (if defined) doesn't have a floating IP defined and also
that disableAPIServerFloatingIP (when set) is not False.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #2260