apiVersion: apps/v1
kind: Deployment
metadata:
  name: xd4-alchemist-pull-dep
  labels:
    app: xd4-alchemist-pull-dep
  namespace: processing
spec:
  replicas: 1
  selector:
    matchLabels:
      app: xd4-alchemist-pull-dep
  template:
    metadata:
      annotations:
        iam.amazonaws.com/role: deafrica-ec2-s3_access
      labels:
        app: xd4-alchemist-pull-dep
    spec:
      nodeSelector:
        beta.kubernetes.io/os: linux
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: nodetype
                    operator: In
                    values:
                      - spot
      containers:
        - name: alchemist-processor-container
          image: opendatacube/datacube-alchemist
          command: [ "datacube-alchemist", "processqueue" ]
          resources:
            requests:
              cpu: 2.0
              memory: 8192Mi
            limits:
              cpu: 3
              memory: 8192Mi
          tty: true
          stdin: true
          env:
            - name: ALCHEMIST_PROCESSQUEUE_MESSAGE_QUEUE
              value: "alchemist-c3-dev"
            - name: DB_DATABASE
              value: "ows"
            - name: DB_HOSTNAME
              value: "db-aurora-dea-dev-eks.cluster-ro-cxhoeczwhtar.ap-southeast-2.rds.amazonaws.com"
            - name: DB_PORT
              value: "5432"
            - name: DB_USERNAME
              valueFrom:
                secretKeyRef:
                  name: ows-db
                  key: postgres-username
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: ows-db
                  key: postgres-password
            - name: AWS_ACCESS_KEY_ID
              valueFrom:
                secretKeyRef:
                  name: processing-aws-creds-dev
                  key: AWS_ACCESS_KEY_ID
            - name: AWS_SECRET_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  name: processing-aws-creds-dev
                  key: AWS_SECRET_ACCESS_KEY
            - name: AWS_DEFAULT_REGION
              valueFrom:
                secretKeyRef:
                  name: processing-aws-creds-dev
                  key: AWS_DEFAULT_REGION