-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: validates CONTROL_PLANE_ENDPOINT_IP and NUTANIX_ENDPOINT are distinct #994
Conversation
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.
Can we do this via CEL on the API definitions instead? No need for a custom webhook for this I don't think.
Thanks for the suggestion, will check on CEL usage and update here. |
@jimmidyson I realized, caren APIs do not persist in cluster as CRDs, the CEL validation with kubebuilder annotation will work only if CRD is present. Were you suggesting anything different than this? If no then, we have two choice -
|
@manoj-nutanix I implemented CEL validation for CC variables in CAPI - no need for CRDs :) kubernetes-sigs/cluster-api#9239 |
11bd9b0
to
61dc326
Compare
61dc326
to
23a208d
Compare
@jimmidyson I've another PR which introduces webhook validations for nutanix, should we revert this PR to earlier webhook logic so changes can managed from single place as we want remove them in future anyways. |
Yes that would make sense. Sorry for messing you around! I think this has been useful though to understand the limitations of using CEL and has given me some thoughts on where we should and should not use it. One reason I like it is that it expresses the validation rules as part of the API rather than in opaque webhook logic. My other concern generally about using webhooks for validating resources that CAREN doesn't strictly own (i.e. CAPI Cluster resources) is that if this web is down then it blocks all Cluster mutations, not even just ones that we are trying to validate as part of this work. Anyway, I agree we should move this back alongside the other webhook logic rather than use CEL so we are consistent. |
Closing this PR in favor of #1002 as forked repos don't have access to github secrets so some e2e tests failing. |
What problem does this PR solve?:
api-server raises error if CONTROL_PLANE_ENDPOINT_IP and NUTANIX_ENDPOINT IP are same. It only implements dumb check which compares PC IP with control-plane IP.
Which issue(s) this PR fixes:
Fixes #
https://jira.nutanix.com/browse/NCN-102626
How Has This Been Tested?:
Locally tested on kind cluster
Special notes for your reviewer: