apiVersion: v1
kind: Pod
metadata:
  name: create-deploy-config
spec:
  serviceAccount: admin
  containers:
  - name: create-deploy-config
    image: "{{ base_image.image }}"
    command:
     - /bin/bash
     - -c
     - |
       set -ex
       cat > deploy-config.json <<EOF
       {"location":"k8s","default_namespace":"{{ default_ns.name }}","service_namespace":{}}
       EOF
       kubectl -n {{ default_ns.name }} delete --ignore-not-found secret deploy-config
       kubectl -n {{ default_ns.name }} create secret generic deploy-config --from-file=./deploy-config.json
       if [ {{ default_ns.name }} != {{ batch_pods_ns.name }} ]; then
           kubectl -n {{ batch_pods_ns.name }} delete --ignore-not-found secret deploy-config
           kubectl -n {{ batch_pods_ns.name }} create secret generic deploy-config --from-file=./deploy-config.json
       fi
  restartPolicy: Never
