---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: measurements
  namespace: measurements
  labels:
    app: measurements
spec:
  replicas: 1
  selector:
    matchLabels:
      app: measurements
  template:
    metadata:
      labels:
        app: measurements
      annotations:
        traffic.sidecar.istio.io/excludeOutboundPorts: "8200"
        vault.hashicorp.com/agent-init-first: "true"
        vault.hashicorp.com/agent-inject: "true"
        vault.hashicorp.com/agent-pre-populate-only: "true"
        vault.hashicorp.com/auth-path: auth/kubernetes
        vault.hashicorp.com/role: measurements
        vault.hashicorp.com/agent-inject-secret-measurements-s3: secrets/data/minio/apps/measurements
        vault.hashicorp.com/agent-inject-template-measurements-s3: |-
          {{- with secret "secrets/data/minio/apps/measurements" -}}
          S3_JSON_SETTINGS='{"host":"{{ index .Data.data.client "endpoint" }}","login":"{{ index .Data.data "access_key" }}","password":"{{ index .Data.data "secret_key" }}","verify":false,"buckets":["measurements"]}'
          {{- end -}}
    spec:
      serviceAccountName: measurements-vault
      containers:
        - name: measurements
          image: cr.yandex/crp3ccidau046kdj8g9q/measurements:production_a5bb3e84
          imagePullPolicy: IfNotPresent
          command: ["/bin/bash", "-ec"]
          args:
            - |
              set -a
              [ -f /vault/secrets/measurements-s3 ] && . /vault/secrets/measurements-s3
              set +a
              exec /opt/entrypoint.sh
          ports:
            - name: http
              containerPort: 8000
              protocol: TCP
          env:
            - name: TRACING_USE
              value: "false"
          resources:
            requests:
              cpu: 25m
              memory: 128Mi
      imagePullSecrets:
        - name: regcred
