# Source: kubernetes-external-secrets/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kubernetes-external-secrets
  namespace: "secret-infra"
  labels:
    app.kubernetes.io/name: kubernetes-external-secrets
    helm.sh/chart: kubernetes-external-secrets-6.2.2
    app.kubernetes.io/instance: kubernetes-external-secrets
    app.kubernetes.io/managed-by: Helm
    gitops.jenkins-x.io/pipeline: 'namespaces'
  annotations:
    wave.pusher.com/update-on-config-change: 'true'
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: kubernetes-external-secrets
      app.kubernetes.io/instance: kubernetes-external-secrets
  template:
    metadata:
      labels:
        app.kubernetes.io/name: kubernetes-external-secrets
        app.kubernetes.io/instance: kubernetes-external-secrets
    spec:
      serviceAccountName: kubernetes-external-secrets
      initContainers:
        - args:
            - kubectl get secret -n jx-vault vault-tls -o jsonpath='{.data.ca\.crt}' | base64 --decode > /tmp/vault/ca.crt
          command:
            - /bin/sh
            - -c
          image: bitnami/kubectl:1.20.2
          name: init-vault-secret
          volumeMounts:
            - mountPath: /tmp/vault
              name: vault-ca
      containers:
        - name: kubernetes-external-secrets
          image: "ghcr.io/external-secrets/kubernetes-external-secrets:6.2.0"
          ports:
            - name: prometheus
              containerPort: 3001
          imagePullPolicy: IfNotPresent
          resources: {}
          env:
            - name: "AWS_DEFAULT_REGION"
              value: "us-west-2"
            - name: "AWS_REGION"
              value: "us-west-2"
            - name: "LOG_LEVEL"
              value: "info"
            - name: "LOG_MESSAGE_KEY"
              value: "msg"
            - name: "METRICS_PORT"
              value: "3001"
            - name: "NODE_EXTRA_CA_CERTS"
              value: "/usr/local/share/ca-certificates/ca.crt"
            - name: "POLLER_INTERVAL_MILLISECONDS"
              value: "10000"
            - name: "VAULT_ADDR"
              value: "https://vault.jx-vault:8200"
            - name: "WATCH_TIMEOUT"
              value: "60000"
          # Params for env vars populated from k8s secrets
          volumeMounts:
            - name: vault-ca
              mountPath: /usr/local/share/ca-certificates
              readOnly: true
      securityContext:
        runAsNonRoot: true
      volumes:
        - name: vault-ca
          emptyDir: {}
