Add phase 1 of validation tightening.
https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/177-volume-snapshot/tighten-validation-webhook-crd.md 1. Ratcheting validation webhook server image 2. Controller labels invalid objects 3. Unit tests for webhook 4. Deployment README and example deployment method with certs 5. Update top-level README Racheting validation: 1. webhook is strict on create 2. webhook is strict on updates where the existing object passes strict validation 3. webhook is relaxed on updates where the existing object fails strict validation (allows finalizer removal, status update, deletion, etc) Additionally the validating wehook server will perform immutability checks on scenario 2 above.
This commit is contained in:
44
deploy/kubernetes/webhook-example/webhook.yaml
Normal file
44
deploy/kubernetes/webhook-example/webhook.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: snapshot-validation-deployment
|
||||
namespace: default # NOTE: change the namespace
|
||||
labels:
|
||||
app: snapshot-validation
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: snapshot-validation
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: snapshot-validation
|
||||
spec:
|
||||
containers:
|
||||
- name: snapshot-validation
|
||||
image: k8s.gcr.io/sig-storage/validation-webhook:v2.2.0 # change the image if you wish to use your own custom validation server image
|
||||
args: ['--tls-cert-file=/etc/snapshot-validation-webhook/certs/cert.pem', '--tls-private-key-file=/etc/snapshot-validation-webhook/certs/key.pem']
|
||||
ports:
|
||||
- containerPort: 443 # change the port as needed
|
||||
volumeMounts:
|
||||
- name: snapshot-validation-webhook-certs
|
||||
mountPath: /etc/snapshot-validation-webhook/certs
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: snapshot-validation-webhook-certs
|
||||
secret:
|
||||
secretName: snapshot-validation-secret
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: snapshot-validation-service
|
||||
namespace: default # NOTE: change the namespace
|
||||
spec:
|
||||
selector:
|
||||
app: snapshot-validation
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 443 # Change if needed
|
||||
targetPort: 443 # Change if the webserver image expects a different port
|
Reference in New Issue
Block a user