apiVersion: apps/v1
kind: Deployment
metadata:
  name: yace-elb
  namespace: monitoring
spec:
  selector:
    matchLabels:
      app: yace-elb
  replicas: 1
  template:
    metadata:
      labels:
        app: yace-elb
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "5000"
    spec:
      containers:
      - name: yace
        image: quay.io/invisionag/yet-another-cloudwatch-exporter:v0.16.0-alpha
        ports:
        - containerPort: 5000
        volumeMounts:
          - name: yace-elb-config
            mountPath: /tmp/config.yml
            subPath: config.yml
          - name: yace-credentials
            mountPath: /exporter/.aws/credentials
            subPath: credentials
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
      volumes:
        - configMap:
            defaultMode: 420
            name: yace-elb-config
          name: yace-elb-config
        - secret:
            defaultMode: 420
            secretName: yace-credentials
          name: yace-credentials
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: yace-elb-config
  namespace: monitoring
data:
  config.yml: |
    discovery:
      jobs:
      - region: us-west-2
        type: elb
        enableMetricData: true
        metrics:
          - name: BackendConnectionErrors
            statistics:
            - Sum
            period: 300
            length: 3600
            nilToZero: true
          - name: HealthyHostCount
            statistics:
            - Sum
            period: 300
            length: 3600
            nilToZero: true
          - name: HTTPCode_Backend_2XX
            statistics:
            - Sum
            period: 300
            length: 3600
            nilToZero: true
          - name: HTTPCode_Backend_3XX
            statistics:
            - Sum
            period: 300
            length: 3600
            nilToZero: true
          - name: HTTPCode_Backend_4XX
            statistics:
            - Sum
            period: 300
            length: 3600
            nilToZero: true
          - name: HTTPCode_Backend_5XX
            statistics:
            - Sum
            period: 300
            length: 3600
            nilToZero: true
          - name: HTTPCode_ELB_4XX
            statistics:
            - Sum
            period: 300
            length: 3600
            nilToZero: true
          - name: HTTPCode_ELB_5XX
            statistics:
            - Sum
            period: 300
            length: 3600
          - name: Latency
            statistics:
            - Average
            - p95
            period: 300
            length: 3600
          - name: RequestCount
            statistics:
            - Sum
            period: 300
            length: 3600
          - name: SpilloverCount
            statistics:
            - Sum
            period: 300
            length: 3600
            nilToZero: true
          - name: SurgeQueueLength
            statistics:
            - Maximum
            period: 300
            length: 3600
            nilToZero: true
          - name: UnHealthyHostCount
            statistics:
            - Minimum
            period: 300
            length: 3600
            nilToZero: true