apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/component: query-cache
    app.kubernetes.io/instance: observatorium-xyz
    app.kubernetes.io/name: thanos-query-frontend
    app.kubernetes.io/part-of: observatorium
    app.kubernetes.io/version: master-2020-08-12-70f89d83
  name: observatorium-xyz-thanos-query-frontend
  namespace: observatorium
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/component: query-cache
      app.kubernetes.io/instance: observatorium-xyz
      app.kubernetes.io/name: thanos-query-frontend
      app.kubernetes.io/part-of: observatorium
  template:
    metadata:
      labels:
        app.kubernetes.io/component: query-cache
        app.kubernetes.io/instance: observatorium-xyz
        app.kubernetes.io/name: thanos-query-frontend
        app.kubernetes.io/part-of: observatorium
        app.kubernetes.io/version: master-2020-08-12-70f89d83
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app.kubernetes.io/name
                  operator: In
                  values:
                  - thanos-query-frontend
              namespaces:
              - observatorium
              topologyKey: kubernetes.io/hostname
            weight: 100
      containers:
      - args:
        - query-frontend
        - --query-frontend.compress-responses
        - --http-address=0.0.0.0:9090
        - --query-frontend.downstream-url=http://observatorium-xyz-thanos-query.observatorium.svc.cluster.local.:9090
        - --query-range.split-interval=24h
        - --query-range.max-retries-per-request=0
        - --query-frontend.log_queries_longer_than=5s
        - |-
          --query-range.response-cache-config="config":
            "max_size": "0"
            "max_size_items": 2048
            "validity": "6h"
          "type": "in-memory"
        image: quay.io/thanos/thanos:master-2020-08-12-70f89d83
        livenessProbe:
          failureThreshold: 4
          httpGet:
            path: /-/healthy
            port: 9090
            scheme: HTTP
          periodSeconds: 30
        name: thanos-query-frontend
        ports:
        - containerPort: 9090
          name: http
        readinessProbe:
          failureThreshold: 20
          httpGet:
            path: /-/ready
            port: 9090
            scheme: HTTP
          periodSeconds: 5
        terminationMessagePolicy: FallbackToLogsOnError
      terminationGracePeriodSeconds: 120
