apiVersion: batch/v1
kind: Job
metadata:
  name:  vault-trailing-slash-secrets-as-names
spec:
  backoffLimit: 0
  completions: 1
  parallelism: 1
  template:
    metadata:
      name:  vault-trailing-slash-secrets-as-names
      annotations:
        vault.secret.manager/enabled: "true"
        vault.secret.manager/service: "https://vault.default.svc.cluster.local:8200"
        vault.secret.manager/tls-secret-name: "vault-consul-ca"
        vault.secret.manager/role: "tester"
        vault.secret.manager/path: "secrets/v2/multi/secrets/path/"
        vault.secret.manager/use-secret-names-as-keys: "true"
    spec:
      restartPolicy: Never
      serviceAccountName: tester
      containers:
      - name: alpine
        image: alpine
        command:
          - "/bin/sh"
          - "-c"
          - |
              echo "testing subtree each path as key name with a single value"
              [ -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 "$APP_USER" ] && echo "APP_USER: $APP_USER"
              [ -n "$DB_USER" ] && echo "DB_USER: $DB_USER"
              exit 0
        resources:
            limits:
              cpu: 0.5m
              memory: 100M
