apiVersion: batch/v1
kind: Job
metadata:
  name:  vault-multi-secrets
spec:
  backoffLimit: 1
  completions: 1
  parallelism: 1
  template:
    metadata:
      name:  vault-multi-secrets
      annotations:
        vault.secret.manager/enabled: "true"
        vault.secret.manager/service: "https://vault.default.svc.cluster.local:8200"
        vault.secret.manager/tls-secret: "vault-consul-ca"
        vault.secret.manager/vault-role: "tester"
        vault.secret.manager/secret-config-1: '{"Path": "secrets/v2/plain/secrets/db*"}'
        vault.secret.manager/secret-config-2: '{"Path": "secrets/v2/plain/secrets/path/app", "Version": "2"}'
        vault.secret.manager/secret-config-10: '{"path": "secrets/v1/multi/secrets/path/", "use-secret-names-as-keys": "true"}'
        vault.secret.manager/secret-config-11: '{"path": "secrets/v1/multi2/secrets/path/", "use-secret-names-as-keys": "true"}'
    spec:
      restartPolicy: Never
      serviceAccountName: tester
      containers:
      - name: alpine
        image: alpine
        command:
          - "sh"
          - "-c"
          - |
              echo "db params"
              [ -n "$USER" ] && echo "USER: $USER"
              [ -n "$PASSWORD" ] && echo "PASSWORD: $PASSWORD"
              [ -n "$PARAM1" ] && echo "PARAM1: $PARAM1"
              [ -n "$PARAM2" ] && echo "PARAM2: $PARAM2"
              [ -n "$PARAM3" ] && echo "PARAM3: $PARAM3"

              echo "app params"
              [ -n "$TESTERS" ] && echo "TESTERS: $TESTERS"
              [ -n "$API_KEY" ] && echo "API_KEY: $API_KEY"
              [ -n "$DATABASE_URL" ] && echo "DATABASE_URL: $DATABASE_URL"
              [ -n "$DB_PASSWORD" ] && echo "DB_PASSWORD: $DB_PASSWORD"
              [ -n "$DB" ] && echo "DB: $DB"
              exit 0
        resources:
            limits:
              cpu: 0.5m
              memory: 100M
