apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend
  namespace: production
spec:
  selector:
    matchLabels:
      app: backend
  template:
    metadata:
      labels:
        app: backend
    spec:
      containers:
      - image: openstatefoundation/open-raadsinformatie-backend
        imagePullPolicy: Always
        name: backend
        envFrom:
        - configMapRef:
            name: config
        - secretRef:
            name: backend-credentials
        env:
          - name: KAFKA_USERNAME
            valueFrom:
              secretKeyRef:
                name: secrets
                key: KAFKA_USERNAME
          - name: KAFKA_PASSWORD
            valueFrom:
              secretKeyRef:
                name: secrets
                key: KAFKA_PASSWORD
          - name: POSTGRES_USERNAME
            valueFrom:
              secretKeyRef:
                name: secrets
                key: POSTGRES_USERNAME
          - name: POSTGRES_PASSWORD
            valueFrom:
              secretKeyRef:
                name: secrets
                key: POSTGRES_PASSWORD
        volumeMounts:
        - mountPath: /tmp
          name: tempdir
        resources:
          requests:
            memory: 400Mi
      securityContext:
        runAsUser: 1000
        fsGroup: 1000
      volumes:
      - name: tempdir
        emptyDir:
          medium: Memory
      nodeSelector:
        cloud.google.com/gke-preemptible: "true"
