---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend
spec:
  replicas: 2
  selector:
    matchLabels:
      app: backend
  template:
    metadata:
      labels:
        app: backend
    spec:
      containers:
      - name: backend
        image: meine-stadt-transparent
        resources:
          limits:
            memory: 500Mi
            cpu: "1"
          requests:
            memory: 250Mi
            cpu: 500m
        envFrom:
        - secretRef:
            name: config
        env:
        - name: ELASTICSEARCH_PASSWORD
          valueFrom:
            secretKeyRef:
              name: aachen-transparent-es-elastic-user
              key: elastic
        - name: ELASTICSEARCH_URL
          value: https://elastic:$(ELASTICSEARCH_PASSWORD)@aachen-transparent-es-http:9200
        - name: MINIO_HOST
          valueFrom:
            configMapKeyRef:
              name: aachen-transparent-files
              key: BUCKET_HOST
        - name: MINIO_REGION
          valueFrom:
            configMapKeyRef:
              name: aachen-transparent-files
              key: BUCKET_REGION
        # We use a dedicated CephObjectStoreUser with manually granted access
        # to all buckets (files, cache, gpg-keys)
        # See: env.txt and objectbucketuser.yaml
        #
        # - name: MINIO_ACCESS_KEY
        #   valueFrom:
        #     secretKeyRef:
        #       name: aachen-transparent-files
        #       key: AWS_ACCESS_KEY_ID
        # - name: MINIO_SECRET_KEY
        #   valueFrom:
        #     secretKeyRef:
        #       name: aachen-transparent-files
        #       key: AWS_SECRET_ACCESS_KEY
