datreeio / admission-webhook-datree

Datree offers cluster integration that allows you to validate your resources against your configured policy upon pushing them into a cluster, by using an admission webhook.
https://datree.io/
Apache License 2.0
24 stars 10 forks source link

refactor: [experimental] create TLS certificate via code & save it in a PersistentVolume #421

Open royhadad opened 1 year ago

royhadad commented 1 year ago

This is a draft for creating the TLS certificate via the webhook-server code and saving it in a PersistentVolume shared between the webhook-server's pods.

How does it work?

  1. The webhook-server deployment has a PersistentVolume attached to it (deployment.yaml)
  2. upon webhook-server startup, if no certificates are found in the file system, a TLS certificate and CA are created via the code and saved to the PersistentVolume via the file system.
  3. The certificates are read from the volume, and the webhook-server starts listening for requests.
  4. The webhook-server attaches the CA to the ValidatingWebhookConfiguration and enables it to start forwarding requests to the webhook-server