apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app.kubernetes.io/component: database-write-hashring
    app.kubernetes.io/instance: observatorium-xyz
    app.kubernetes.io/name: thanos-receive
    app.kubernetes.io/part-of: observatorium
    app.kubernetes.io/version: master-2020-08-12-70f89d83
    controller.receive.thanos.io: thanos-receive-controller
    controller.receive.thanos.io/hashring: default
  name: observatorium-xyz-thanos-receive-default
  namespace: observatorium
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/component: database-write-hashring
      app.kubernetes.io/instance: observatorium-xyz
      app.kubernetes.io/name: thanos-receive
      app.kubernetes.io/part-of: observatorium
      controller.receive.thanos.io/hashring: default
  serviceName: observatorium-xyz-thanos-receive-default
  template:
    metadata:
      labels:
        app.kubernetes.io/component: database-write-hashring
        app.kubernetes.io/instance: observatorium-xyz
        app.kubernetes.io/name: thanos-receive
        app.kubernetes.io/part-of: observatorium
        app.kubernetes.io/version: master-2020-08-12-70f89d83
        controller.receive.thanos.io/hashring: default
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app.kubernetes.io/name
                  operator: In
                  values:
                  - thanos-receive
                - key: app.kubernetes.io/instance
                  operator: In
                  values:
                  - observatorium-xyz
              namespaces:
              - observatorium
              topologyKey: kubernetes.io/hostname
            weight: 100
          - podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app.kubernetes.io/name
                  operator: In
                  values:
                  - thanos-receive
                - key: app.kubernetes.io/instance
                  operator: In
                  values:
                  - observatorium-xyz
              namespaces:
              - observatorium
              topologyKey: topology.kubernetes.io/zone
            weight: 100
      containers:
      - args:
        - receive
        - --log.level=debug
        - --grpc-address=0.0.0.0:10901
        - --http-address=0.0.0.0:10902
        - --remote-write.address=0.0.0.0:19291
        - --receive.replication-factor=1
        - --objstore.config=$(OBJSTORE_CONFIG)
        - --tsdb.path=/var/thanos/receive
        - --label=replica="$(NAME)"
        - --label=receive="true"
        - --receive.local-endpoint=$(NAME).observatorium-xyz-thanos-receive-default.$(NAMESPACE).svc.cluster.local:10901
        - --tsdb.retention=4d
        - --receive.hashrings-file=/var/lib/thanos-receive/hashrings.json
        env:
        - name: NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: OBJSTORE_CONFIG
          valueFrom:
            secretKeyRef:
              key: thanos.yaml
              name: thanos-objectstorage
        - name: DEBUG
          value: "1"
        image: quay.io/thanos/thanos:master-2020-08-12-70f89d83
        livenessProbe:
          failureThreshold: 8
          httpGet:
            path: /-/healthy
            port: 10902
            scheme: HTTP
          periodSeconds: 30
        name: thanos-receive
        ports:
        - containerPort: 10901
          name: grpc
        - containerPort: 10902
          name: http
        - containerPort: 19291
          name: remote-write
        readinessProbe:
          failureThreshold: 20
          httpGet:
            path: /-/ready
            port: 10902
            scheme: HTTP
          periodSeconds: 5
        terminationMessagePolicy: FallbackToLogsOnError
        volumeMounts:
        - mountPath: /var/thanos/receive
          name: data
          readOnly: false
        - mountPath: /var/lib/thanos-receive
          name: hashring-config
      terminationGracePeriodSeconds: 900
      volumes:
      - emptyDir: {}
        name: data
      - configMap:
          name: observatorium-xyz-thanos-receive-controller-tenants-generated
        name: hashring-config
  volumeClaimTemplates: null
