apiVersion: apps/v1
kind: Deployment
metadata:
  name: drs3
  labels:
    app: drs3
spec:
  replicas: 1
  selector:
    matchLabels:
      app: drs3
  template:
    metadata:
      annotations:
        vault.hashicorp.com/agent-inject: "true"
        vault.hashicorp.com/agent-init-first: "true"
        vault.hashicorp.com/tls-skip-verify: "true"
        vault.hashicorp.com/agent-inject-secret-variables: 'secret/files/drs3'
        vault.hashicorp.com/agent-inject-template-variables: |
          {{ with secret "secret/files/drs3" -}}
            export DRS3_DB_URL="{{ .Data.db_url }}"
          export DRS3_S3_ACCESS_KEY_ID="{{ .Data.s3_access }}"
          export DRS3_S3_ENDPOINT_URL="{{ .Data.s3_url }}"
          export DRS3_S3_OUTBOX_BUCKET_ID="{{ .Data.s3_outbox_bucket }}"
          export DRS3_S3_SECRET_ACCESS_KEY="{{ .Data.s3_secret }}"
          export DRS3_DRS_SELF_URL="{{ .Data.drs_self_url }}"
          export DRS3_CUSTOM_SPEC_URL="{{ .Data.custom_spec_url }}"
          {{- end }}
        vault.hashicorp.com/role: "files-io-role"
      labels:
        app: drs3
        version: 1-dev
    spec:
      serviceAccountName: drs3
      containers:
      - name: drs3
        image: ghga/drs3:4alex-02
        command: ["bash"]
        args:  [ '-c', 'source /vault/secrets/variables && drs3 run-api']
        ports:
        - name: http
          containerPort: 8080
          protocol: TCP
        volumeMounts:
        - name: config
          mountPath: "/home/appuser"
          readOnly: true
      volumes:
      - name: config
        configMap:
          name: drs3
