apiVersion: apps/v1
kind: Deployment
metadata:
  name: metarank-api
  labels:
    app: metarank-api
spec:
  selector:
    matchLabels:
      app: metarank-api
  replicas: 2
  template:
    metadata:
      labels:
        app: metarank-api
    spec:
      volumes:
        - name: config
          configMap:
            name: metarank-config
      containers:
        - name: metarank-api
          image: metarank/metarank:0.4.1
          args: ["api"]
          readinessProbe:
            httpGet:
              path: /health
              port: http-api
            initialDelaySeconds: 10
            periodSeconds: 10
          env:
            - name: METARANK_CONFIG
              value: /config/config.yml
            - name: AWS_REGION
              value: us-east-1
            - name: AWS_ACCESS_KEY_ID
              valueFrom:
                secretKeyRef:
                  name: metarank-keys
                  key: AWS_ACCESS_KEY_ID
            - name: AWS_SECRET_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  name: metarank-keys
                  key: AWS_SECRET_ACCESS_KEY

          ports:
            - name: http-api
              containerPort: 8080
          volumeMounts:
            - name: config
              mountPath: /config/
          resources:
            requests:
              memory: 800Mi
              cpu: 300m
