---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: emojify-api
  labels:
    app: emojify-api
spec:
  replicas: 1
  selector:
    matchLabels:
      app: emojify-api
  template:
    metadata:
      labels:
        app: emojify-api
      annotations:
        "consul.hashicorp.com/connect-inject": "true"
        "consul.hashicorp.com/connect-service-protocol": "http"
        "consul.hashicorp.com/connect-service-upstreams": "emojify-facedetect:8003,emojify-cache:8005"
        "prometheus_io_scrape": "true"
    spec:
      containers:
      - name: emojify-api
        image: "nicholasjackson/emojify-api:v0.9.8"
        imagePullPolicy: Always
        command: ["/service/emojify-api"]
        ports:
        - containerPort: 9090
        env:
          - name: AUTHN_DISABLE
            value: "true"
          - name: CACHE_ADDRESS
            value: localhost:8005
          - name: FACEBOX_ADDRESS
            value: localhost:8003
          - name: STATSD_ADDRESS
            value: localhost:9125
          - name: BIND_ADDRESS
            value: "127.0.0.1:9090"
        resources:
          limits:
            cpu: 300m
          requests:
            cpu: 100m
            memory: 100Mi

      - name: prometheus-statsd
        image: "prom/statsd-exporter:latest"
        ports:
          - name: metrics
            containerPort: 9102
          - name: statsd
            containerPort: 9125
        resources:
          limits:
            memory: 100Mi
          requests:
            cpu: 100m
            memory: 100Mi
