---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: snapshot-controller
  namespace: democratic-csi
spec:
  replicas: 2
  selector:
    matchLabels:
      app: snapshot-controller
  # the snapshot controller won't be marked as ready if the v1 CRDs are unavailable
  # in #504 the snapshot-controller will exit after around 7.5 seconds if it
  # can't find the v1 CRDs so this value should be greater than that
  minReadySeconds: 15
  strategy:
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: snapshot-controller
    spec:
      serviceAccount: snapshot-controller
      containers:
        - name: snapshot-controller
          image: k8s.gcr.io/sig-storage/snapshot-controller:v5.0.1
          args:
            - "--v=5"
            - "--leader-election=true"
          imagePullPolicy: IfNotPresent
### validating webhook
# ---
# kind: Deployment
# apiVersion: apps/v1
# metadata:
#   name: snapshot-validation-deployment
#   namespace: democratic-csi
#   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/snapshot-validation-webhook:v4.2.1 # change the image if you wish to use your own custom validation server image
#         imagePullPolicy: IfNotPresent
#         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: democratic-csi # 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
