Skip to content
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

Add validation via Admission Webhook #85

Open
2 tasks
JohnStrunk opened this issue Mar 4, 2020 · 0 comments
Open
2 tasks

Add validation via Admission Webhook #85

JohnStrunk opened this issue Mar 4, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@JohnStrunk
Copy link
Member

Describe the feature you'd like to have.
Add a Validating Webhook to improve the validity checking of the SnapshotSchedule CR.

What is the value to the end user? (why is it a priority?)
The current openapi validation handles some validation, but not all field validation can be adequately expressed using openapi. Errors currently missed by openapi validation will only be discovered after the operator tries to reconcile, with error reporting limited to the .status field of the affected CR.
By adding a validating webhook, more (all?) errors can be found when the object is first created, so the create/update can be immediately rejected, providing more timely feedback to the user. This will also improve error reporting capabilities via the web console.

How will we know we have a good solution? (acceptance criteria)

  • .spec.schedule should be validated by parsing it to ensure it's a valid cronspec (i.e., all values are in range)
  • .spec.retention.expires should properly parse as a time.Duration

Additional context
This should be viewed as an enhancement on top of the openapi validation, not a substitute. The openapi validation should still be the first line of defense since those rules are exposed in the CRD, whereas the webhook's rules are opaque to the user.

Starting point (from this tutorial at KubeConNA 2019):
https://github.com/jpbetz/KoT/tree/master/admission

@JohnStrunk JohnStrunk added the enhancement New feature or request label Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant