apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app.kubernetes.io/component: object-store-gateway
    app.kubernetes.io/instance: observatorium-xyz
    app.kubernetes.io/name: thanos-store
    app.kubernetes.io/part-of: observatorium
    app.kubernetes.io/version: v0.24.0
    store.thanos.io/shard: shard-0
  name: observatorium-xyz-thanos-store-shard-0
  namespace: observatorium
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/component: object-store-gateway
      app.kubernetes.io/instance: observatorium-xyz
      app.kubernetes.io/name: thanos-store
      app.kubernetes.io/part-of: observatorium
      store.thanos.io/shard: shard-0
  serviceName: observatorium-xyz-thanos-store-shard-0
  template:
    metadata:
      labels:
        app.kubernetes.io/component: object-store-gateway
        app.kubernetes.io/instance: observatorium-xyz
        app.kubernetes.io/name: thanos-store
        app.kubernetes.io/part-of: observatorium
        app.kubernetes.io/version: v0.24.0
        store.thanos.io/shard: shard-0
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app.kubernetes.io/name
                  operator: In
                  values:
                  - thanos-store
                - key: app.kubernetes.io/instance
                  operator: In
                  values:
                  - observatorium-xyz
              namespaces:
              - observatorium
              topologyKey: kubernetes.io/hostname
            weight: 100
      containers:
      - args:
        - store
        - --log.level=info
        - --log.format=logfmt
        - --data-dir=/var/thanos/store
        - --grpc-address=0.0.0.0:10901
        - --http-address=0.0.0.0:10902
        - --objstore.config=$(OBJSTORE_CONFIG)
        - --ignore-deletion-marks-delay=24h
        - |-
          --index-cache.config="config":
            "addresses":
            - "dnssrv+_client._tcp.observatorium-xyz-thanos-store-memcached.observatorium.svc"
            "dns_provider_update_interval": "10s"
            "max_async_buffer_size": 100000
            "max_async_concurrency": 100
            "max_get_multi_batch_size": 1000
            "max_get_multi_concurrency": 900
            "max_idle_connections": 1000
            "max_item_size": "1MiB"
            "timeout": "2s"
          "type": "memcached"
        - |-
          --store.caching-bucket.config="blocks_iter_ttl": "5m"
          "chunk_object_attrs_ttl": "24h"
          "chunk_subrange_size": 16000
          "chunk_subrange_ttl": "24h"
          "config":
            "addresses":
            - "dnssrv+_client._tcp.observatorium-xyz-thanos-store-memcached.observatorium.svc"
            "dns_provider_update_interval": "10s"
            "max_async_buffer_size": 100000
            "max_async_concurrency": 100
            "max_get_multi_batch_size": 1000
            "max_get_multi_concurrency": 900
            "max_idle_connections": 1000
            "max_item_size": "1MiB"
            "timeout": "2s"
          "max_chunks_get_range_requests": 3
          "metafile_content_ttl": "24h"
          "metafile_doesnt_exist_ttl": "15m"
          "metafile_exists_ttl": "2h"
          "metafile_max_size": "1MiB"
          "type": "memcached"
        - |
          --selector.relabel-config=
            - action: hashmod
              source_labels: ["__block_id"]
              target_label: shard
              modulus: 1
            - action: keep
              source_labels: ["shard"]
              regex: 0
        env:
        - name: OBJSTORE_CONFIG
          valueFrom:
            secretKeyRef:
              key: thanos.yaml
              name: thanos-objectstorage
        - name: HOST_IP_ADDRESS
          valueFrom:
            fieldRef:
              fieldPath: status.hostIP
        image: quay.io/thanos/thanos:v0.24.0
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 8
          httpGet:
            path: /-/healthy
            port: 10902
            scheme: HTTP
          periodSeconds: 30
        name: thanos-store
        ports:
        - containerPort: 10901
          name: grpc
        - containerPort: 10902
          name: http
        readinessProbe:
          failureThreshold: 20
          httpGet:
            path: /-/ready
            port: 10902
            scheme: HTTP
          periodSeconds: 5
        resources: {}
        terminationMessagePolicy: FallbackToLogsOnError
        volumeMounts:
        - mountPath: /var/thanos/store
          name: data
          readOnly: false
      nodeSelector:
        kubernetes.io/os: linux
      securityContext:
        fsGroup: 65534
        runAsUser: 65534
      serviceAccountName: observatorium-xyz-thanos-store-shard
      terminationGracePeriodSeconds: 120
      volumes: []
  volumeClaimTemplates:
  - metadata:
      labels:
        app.kubernetes.io/component: object-store-gateway
        app.kubernetes.io/instance: observatorium-xyz
        app.kubernetes.io/name: thanos-store
        app.kubernetes.io/part-of: observatorium
        store.thanos.io/shard: shard-0
      name: data
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 50Gi
