-
Notifications
You must be signed in to change notification settings - Fork 260
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
🐛 Prevent the bastion to be removed before it's been disabled #1866
Conversation
✅ Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I manually tested it and it worked:
|
@@ -116,6 +116,13 @@ func (r *OpenStackCluster) ValidateUpdate(oldRaw runtime.Object) (admission.Warn | |||
r.Spec.APIServerPort = 0 | |||
} | |||
|
|||
// Allow to remove the bastion spec only if it was disabled before. | |||
if r.Spec.Bastion == nil { | |||
if old.Spec.Bastion != nil && old.Spec.Bastion.Enabled { |
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.
note that I didn't add a guard to compare the old instance with the new one because there are complicated objects with filters. If we want to go down that path, let me know although I'm not sure it's desired.
Otherwise let me know if the doc content is enough.
We now have a webhook that checks that a bastion has been disabled if a change has to be made (update or delete) in the bastion field. We also document it better. Also, we added some code to prevent that we don't have a nil pointer if the Spec.Bastion or Status.Bastion are unset.
Looks good, the more detailed documentation looks to be easy to follow 👍 /lgtm |
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.
How do you fancy writing an e2e test for this? We keep breaking it.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: EmilienM, 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 |
On my list: #1822 |
What this PR does / why we need it:
We now have a webhook that checks that a bastion has been disabled if a
change has to be made (update or delete) in the bastion field.
We also document it better.
Also, we added some code to prevent that we don't have a nil pointer if
the Spec.Bastion or Status.Bastion are unset.
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 #1855
TODOs: