-
Notifications
You must be signed in to change notification settings - Fork 29
OLS-1435: add validation webhook for OLSConfig CRD #879
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?
Conversation
|
@raptorsun: This pull request references OLS-1435 which is a valid jira issue. 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 openshift-eng/jira-lifecycle-plugin repository. |
|
[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 |
|
@raptorsun did you look at using CRD schema validation rules to do this instead of a webhook? I'm pretty sure it's possible to define schema rules for most, if not all, of these checks and avoid running/managing the webhook (not to mention the webhook becomes a point of failure since the CR instances can't be managed if the webhook is down for some reason): https://kubernetes.io/blog/2022/09/23/crd-validation-rules-beta/ even if you don't want to use the beta feature (CEL), there's also validation that can be done on things like field name (for the |
7435be2 to
9b8dd73
Compare
|
/retest |
Yes, I have checked the validation tools provided by kubebuilder. CRD validation rules works well when all the required information comes from the object itself. Last year we have investigated several config problems reported by users, many of which leads to a reference to inexistent secret, configmap. CRD validation rules cannot verify reffered resources so I'd like to put a validation webhook here to prevent users mistakenly change the OLSConfig with reference to inexistent resources. This PR starts with the token secret. In future we will add reference to configmaps such as those containing TLS certs, too. |
If someone deletes the referenced configmap/secret, does the operator reconciliation flag that in status the next time it reconciles the olsconfig object? |
yes, errors during reconciliation is put into the status of OLSConfig. |
| @@ -0,0 +1,29 @@ | |||
| # This patch add annotation to admission webhook config and | |||
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.
leave these code blocks here in case we need mutation webhook in future
|
/retest |
|
bundle is still using old operator image, we need merge this PR first and then quickly update the operator image in the bundle to deblock the integrations tests:
|
|
/lgtm |
|
New changes are detected. LGTM label has been removed. |
Signed-off-by: Haoyu Sun <[email protected]>
Signed-off-by: Haoyu Sun <[email protected]>
Signed-off-by: Haoyu Sun <[email protected]>
Signed-off-by: Haoyu Sun <[email protected]>
|
@raptorsun: all tests passed! Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
Description
Type of change
Related Tickets & Documents
Checklist before requesting a review
Testing