apiVersion: apps/v1
kind: Deployment
metadata:
  name: image-rewrite-webhook
  namespace: image-rewrite
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/instance: image-rewrite
      app.kubernetes.io/name: webhook
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: image-rewrite
        app.kubernetes.io/name: webhook
    spec:
      serviceAccountName: image-rewrite-webhook
      volumes:
        - name: webhook-certs
          secret:
            secretName: image-rewrite-webhook-certs
        - name: webhook-config
          configMap:
            name: image-rewrite-webhook-config
      containers:
        - name: image-rewrite
          image: image-rewrite:0.0.1
          args:
            - -rewriteCfgFile=/etc/webhook/config/rewrite-config.yaml
            - -tlsCertFile=/etc/webhook/certs/cert.pem
            - -tlsKeyFile=/etc/webhook/certs/key.pem
            - -alsologtostderr
            - -v=4
            - 2>&1
          ports:
            - name: https
              containerPort: 8443
              protocol: TCP
          volumeMounts:
            - name: webhook-certs
              mountPath: /etc/webhook/certs
              readOnly: true
            - name: webhook-config
              mountPath: /etc/webhook/config
