apiVersion: apps/v1
kind: Deployment
metadata:
  name: imageswap-webhook-deployment
  namespace: imageswap
  labels:
    app: imageswap
    imageswap.ironbank.dso.mil: "disabled"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: imageswap
  template:
    metadata:
      labels:
        app: imageswap
        imageswap.ironbank.dso.mil: "disabled"
    spec:
      containers:
        - name: imageswap
          image: localhost:5000/ironbank/imageswap/imageswap:latest
          imagePullPolicy: Always
          args:
            - "/imageswap"
            - "$(ECR_HOSTNAME)"
            # - --tls-cert-file=/etc/webhook/certs/cert.pem
            # - --tls-cert-key=/etc/webhook/certs/key.pem
          volumeMounts:
          - name: webhook-certs
            mountPath: /etc/webhook/certs
            readOnly: true
          env:
          - name: ECR_HOSTNAME
            valueFrom:
              configMapKeyRef:
                name: imageswap-configuration
                key: ECR_HOSTNAME
      volumes:
      - name: webhook-certs
        secret:
          secretName: imageswap-webhook-certs
