apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: thanos-querier
  name: thanos-querier
  namespace: observatorium
spec:
  replicas: 3
  selector:
    matchLabels:
      app.kubernetes.io/name: thanos-querier
  template:
    metadata:
      labels:
        app.kubernetes.io/name: thanos-querier
        app.kubernetes.io/tracing: jaeger-agent
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app.kubernetes.io/name
                  operator: In
                  values:
                  - thanos-querier
              namespaces:
              - observatorium
              topologyKey: kubernetes.io/hostname
            weight: 100
      containers:
      - args:
        - query
        - --query.replica-label=replica
        - --query.replica-label=ruler_replica
        - --query.replica-label=prometheus_replica
        - --grpc-address=0.0.0.0:10901
        - --http-address=0.0.0.0:9090
        - --store=dnssrv+_grpc._tcp.thanos-store.observatorium.svc.cluster.local
        - --store=dnssrv+_grpc._tcp.thanos-ruler.observatorium.svc.cluster.local
        - |
          --tracing.config=
            type: JAEGER
            config:
              service_name: thanos-querier
              sampler_type: ratelimiting
              sampler_param: 2
        - --store=dnssrv+_grpc._tcp.thanos-receive-default.observatorium.svc.cluster.local
        image: quay.io/thanos/thanos:v0.9.0
        livenessProbe:
          failureThreshold: 4
          httpGet:
            path: /-/healthy
            port: 9090
            scheme: HTTP
          periodSeconds: 30
        name: thanos-querier
        ports:
        - containerPort: 10901
          name: grpc
        - containerPort: 9090
          name: http
        readinessProbe:
          httpGet:
            path: /-/ready
            port: 9090
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 30
        resources:
          limits:
            cpu: "1"
            memory: 1Gi
          requests:
            cpu: 100m
            memory: 256Mi
      - args:
        - --reporter.grpc.host-port=dns:///jaeger-collector-headless.$(NAMESPACE).svc:14250
        - --reporter.type=grpc
        - --jaeger.tags=pod.namespace=$(NAMESPACE),pod.name=$(POD)
        env:
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: POD
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        image: jaegertracing/jaeger-agent:1.14.0
        livenessProbe:
          failureThreshold: 5
          httpGet:
            path: /
            port: 14271
            scheme: HTTP
        name: jaeger-agent
        ports:
        - containerPort: 6831
          name: jaeger-thrift
        - containerPort: 5778
          name: configs
        - containerPort: 14271
          name: metrics
        resources:
          limits:
            cpu: 128m
            memory: 128Mi
          requests:
            cpu: 32m
            memory: 64Mi
      terminationGracePeriodSeconds: 120
