SwissDataScienceCenter / amalthea

A kubernetes operator for spawning and exposing interactive user session servers.
Apache License 2.0
14 stars 4 forks source link

Add defaulting and validating webhooks for amalthea sessions #749

Open olevski opened 3 weeks ago

olevski commented 3 weeks ago

These would be useful in a few cases:

  1. To get a non-null status for status fields that depend on fields that the creator of a session can change (directly or indirectly). I.e. as soon as you create a session the status field in the CR has 0 for the number of both ready and non-ready containers. Then in the next request / reconcile cycle the value will be set properly. But the response from a POST will always be weird. A defaulting webhook would fix this.
  2. To validate and fail when certain thing are not well defined. Some things we cannot encode in the json schema in the CRD. For example the extraVolumes field has to unique names for each volume. And we should not even accept a POST request to create a session that has duplicates for volume names. The way to reject such a request - i.e. to send 422 or 400 on the post request to create a session is to use a validating webhook.

There are or will be more use cases for this.

olevski commented 3 weeks ago

See #748