apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod2
  labels:
    app: myapp2
spec:
  containers:
  - name: myapp-container
    image: jpbelanger/vault-demo-injection:1.0.0
    command: ['/tmp/kube-pod-decorator', '/app/vault-demo-injection/vault-demo-injection']
    env:
      - name: VAULT_ADDR
        value: http://vault:8200
      - name: K8SPODDECORATOR_VAULTSECRETPATH
        value: /tmp/vault.token
      - name: K8SPODDECORATOR_APPLICATIONNAME
        value: vault-demo-injection
      - name: CONSUL_HTTP_ADDR
        value: consul:8500
    volumeMounts:
    - mountPath: /tmp
      name: wrapper-volume
  initContainers:
  - name: init-myservice
    image: jpbelanger/kube-pod-decorator:1.0.0
    command: ['sh', '-c', 'cp /app/kube-pod-decorator/kube-pod-decorator /tmp && echo 4a9afb73-2125-d5fe-e05d-831f33e00f11 > /tmp/vault.token']
    volumeMounts:
    - mountPath: /tmp
      name: wrapper-volume
  volumes:
    - name: wrapper-volume
      emptyDir:
        medium: "Memory"