kyma icon indicating copy to clipboard operation
kyma copied to clipboard

Validation and Defaulting webhook for eventing subscription CR

Open nachtmaar opened this issue 2 years ago • 2 comments

Description

Write a validation webhook for the eventing Subscription.

Tasks:

  • [ ] Add Defaulting webhook
  • [ ] Add validation of the event-types
  • [ ] Add validation of the event-source
  • [ ] Add validation if there are duplicate event types or no event types
  • [ ] Add validation of the sink
  • [ ] Remove the validation from the Reconcile() and rely on the validation webhook.

AC

  • [ ] Webhook is scaffolded (tip: use kubebuilder for this)
  • [ ] Reject a Subscription with an invalid event-type/source/sink.

Reasons

The reason why we need a webhook is to fail-fast and provide the user with direct feedback about what is wrong in the Subscription. This will also make the controllers easier and slimmer as the validation part is moved to the validation webhook.

Hints/Dependencies

  • There is already a POC for a mutating webhook. You can reuse this and concentrate on implementing the validation :)
  • It probably make sense to implement event-type validation and the sink validation in separate tickets/PRs.

nachtmaar avatar Jul 05 '22 11:07 nachtmaar

This issue has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Sep 04 '22 03:09 github-actions[bot]

  • We should only write the validation webhook for the new subscription CRD version

nachtmaar avatar Sep 09 '22 12:09 nachtmaar

The issue will be addressed in 3 steps:

  • Creating Validation and Mutating webhook resources and writing validations for event source and types: https://github.com/kyma-project/kyma/pull/16049
  • writing validation logic for sink: https://github.com/kyma-project/kyma/pull/16066
  • Integration tests: https://github.com/kyma-project/kyma/issues/16055

raypinto avatar Nov 09 '22 17:11 raypinto