apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: dummy-webhook
  name: dummy-webhook
  namespace: dummy-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: dummy-webhook
  template:
    metadata:
      labels:
        app.kubernetes.io/name: dummy-webhook
    spec:
      containers:
        - command:
            - /dummy-webhook
          image: dummy-webhook:latest
          imagePullPolicy: IfNotPresent
          lifecycle:
            preStop:
              exec:
                command:
                  - sleep
                  - "5"
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8081
            initialDelaySeconds: 15
            periodSeconds: 20
          name: webhook
          ports:
            - containerPort: 9443
              name: webhook-server
              protocol: TCP
            - containerPort: 8080
              name: metrics
            - containerPort: 8081
              name: health
          readinessProbe:
            httpGet:
              path: /readyz
              port: 8081
            initialDelaySeconds: 5
            periodSeconds: 10
          resources:
            requests:
              cpu: 100m
              memory: 20Mi
          securityContext:
            allowPrivilegeEscalation: false
          volumeMounts:
            - mountPath: /certs
              name: cert
              readOnly: true
      securityContext:
        runAsNonRoot: true
      terminationGracePeriodSeconds: 10
      volumes:
        - name: cert
          secret:
            defaultMode: 420
            secretName: dummy-webhook-server-cert
