SAP-archive / karydia

Kubernetes Security Walnut
Other
77 stars 10 forks source link

Upate Webhooks after Upgrade #260

Closed Neumann-Nils closed 4 years ago

Neumann-Nils commented 4 years ago

Description

This PR reapplies the webhook installation script after an upgrade (not just an install). This allows it to make changes to the webhook without deleting and installing Karydia, but rather just upgrading it.

Checklist

Before submitting this PR, please make sure:

Neumann-Nils commented 4 years ago

How to test that the webhook is upgraded with helm upgrade:

  1. Install Karydia:
    kubectl create namespace karydia
    helm install karydia ./install/charts --namespace karydia
  2. Check the configuration of the mutating/validating webhook:
    
    kubectl describe MutatingWebhookConfiguration karydia-webhook
    kubectl describe ValidatingWebhookConfiguration karydia-webhook

[...] Namespace Selector: Match Expressions: Key: app Operator: NotIn Values: karydia [...]

3. Make changes to e.g. the `values.yaml` file:
```diff
     exclusionNamespaceLabels:
-     - key: "app"
-       values:
-       - "karydia"
+     - key: "exclude"
+       values:
+       - "true"
  1. 
    kubectl describe MutatingWebhookConfiguration karydia-webhook
    kubectl describe ValidatingWebhookConfiguration karydia-webhook

[...] Namespace Selector: Match Expressions: Key: exclude Operator: NotIn Values: true [...]