-
Notifications
You must be signed in to change notification settings - Fork 1.4k
🐛 Fix potential panic if ClusterResourceSetStrategy is not defined or incorrect #12096
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
base: main
Are you sure you want to change the base?
🐛 Fix potential panic if ClusterResourceSetStrategy is not defined or incorrect #12096
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 |
/area clusterresourceset |
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.
Does this PR make sense?
We have openapi validation to ensure it is either set to ApplyOnce or to Reconcile.
On top we have defaulting inside the webhook to default to ApplyOnce it it is not set.
or am I missing something here?
The answer: Yes and No. We have some specific installation, i.e. testing or embedded without web-hooks deployment and in this case, the operator will fails with panic instead of correct error message in the logs. For example MachineDeployment or ClusterResourceSet controllers will have correct error message if someone happens with defaults. |
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 neutral about this change, if other maintainers agree I don't mind considering it as defensive programming.
However IMO it is important to set expectations about the use case described in the sentence below:
We have some specific installation, i.e. testing or embedded without web-hooks deployment and in this case, the operator will fails with panic instead of correct error message in the logs. For example MachineDeployment or ClusterResourceSet controllers will have correct error message if someone happens with defaults.
As far as I'm aware of today CAPI is not providing any support for running controllers without web-hooks, and unless I'm mistaken, this was never discussed nor included in any roadmap.
That's means that If you are using CAPI controllers without web-hooks, you are doing this at your risk.
I would also add that IMO if other controllers don't have panic errors when used without web hooks it is just by chance, as well as I would expect other subtle and tricky errors to happen over time due to unexpected values being stored in etcd.
internal/controllers/clusterresourceset/clusterresourceset_scope.go
Outdated
Show resolved
Hide resolved
131dc07
to
56674b0
Compare
56674b0
to
5dc69b6
Compare
What this PR does / why we need it:
This is small fix which prevents potential situation when
resourceScope
anderror
values could benil
simalteniously.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 #