kind: Job
apiVersion: batch/v1
metadata:
  name: copy-certs
spec:
  template:
    metadata:
      name: copy-certs
    spec:
      restartPolicy: OnFailure
      containers:
        - name: copy-certs
          image: amouat/copy-certs-auto
          imagePullPolicy: Always
          volumeMounts:
            - mountPath: /etc/docker
              name: cert-dir
            - mountPath: /hostfile
              name: host-dir
            - mountPath: /copy_certs.sh
              name: kube-registry-config
              subPath: copy_certs.sh
          securityContext:
            privileged: true
      volumes:
        - name: cert-dir
          hostPath: 
            path: /etc/docker
        - name: host-dir
          hostPath: 
            path: /etc/hosts
        - name: kube-registry-config
          configMap:
            name: kube-registry-config
            items:
              - key: copy_certs.sh
                path: copy_certs.sh
                mode: 0700
