apiVersion: apps/v1
kind: Deployment
metadata:
  name: vault-test-bbb
  namespace: bbb
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: vault
  template:
    metadata:
      labels:
        app.kubernetes.io/name: vault
        app: bbb
      annotations:
        #vault.security.banzaicloud.io/vault-addr: "https://vault.vault:8200" # optional, the address of the Vault service, default values is https://vault:8200
        vault.security.banzaicloud.io/vault-role: "bbb" # optional, the default value is the name of the ServiceAccount the Pod runs in, in case of Secrets and ConfigMaps it is "default"
        vault.security.banzaicloud.io/vault-skip-verify: "true" # optional, skip TLS verification of the Vault server certificate
        #vault.security.banzaicloud.io/vault-tls-secret: "vault-tls" # optional, the name of the Secret where the Vault CA cert is, if not defined it is not mounted
        #vault.security.banzaicloud.io/vault-agent: "false" # optional, if true, a Vault Agent will be started to do Vault authentication, by default not needed and vault-env will do Kubernetes Service Account based Vault authentication
        vault.security.banzaicloud.io/vault-path: "kubernetes" # optional, the Kubernetes Auth mount path in Vault the default value is "kubernetes"
        vault.security.banzaicloud.io/vault-ct-configmap: "bbb-consul-template"
    spec:
      serviceAccountName: bbb
      containers:
      - name: alpine
        image: alpine
        command: ["sh", "-c", "echo Direct Env : $BBB_SECRET_DATA_DIRECT_ENV && echo From ConfigMap Env :  $BBB_SECRET_DATA_WITH_CM_ENV && echo From Secret Env :  $BBB_SECRET_DATA_WITH_SECRET_ENV && echo From Mount File : $(cat /vault/secret/BBB_SECRET_DATA_WITH_MOUNT_FILE) && echo going to sleep... && sleep 10000"]
        env:
        - name: BBB_SECRET_DATA_DIRECT_ENV
          value: vault:secret/data/sandbox/bbb#BBB_SECRET_DATA_DIRECT_ENV
        - name: BBB_SECRET_DATA_WITH_CM_ENV
          valueFrom:
            configMapKeyRef:
              name: key-configmap
              key: BBB_SECRET_DATA_WITH_CM_ENV
        - name: BBB_SECRET_DATA_WITH_SECRET_ENV
          valueFrom:
            secretKeyRef:
              name: key-secret
              key: BBB_SECRET_DATA_WITH_SECRET_ENV

