apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app.kubernetes.io/component: database-compactor
    app.kubernetes.io/instance: observatorium-xyz
    app.kubernetes.io/name: thanos-compact
    app.kubernetes.io/part-of: observatorium
    app.kubernetes.io/version: v0.17.1
  name: observatorium-xyz-thanos-compact
  namespace: observatorium
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/component: database-compactor
      app.kubernetes.io/instance: observatorium-xyz
      app.kubernetes.io/name: thanos-compact
      app.kubernetes.io/part-of: observatorium
  serviceName: observatorium-xyz-thanos-compact
  template:
    metadata:
      labels:
        app.kubernetes.io/component: database-compactor
        app.kubernetes.io/instance: observatorium-xyz
        app.kubernetes.io/name: thanos-compact
        app.kubernetes.io/part-of: observatorium
        app.kubernetes.io/version: v0.17.1
    spec:
      containers:
      - args:
        - compact
        - --wait
        - --log.level=info
        - --log.format=logfmt
        - --objstore.config=$(OBJSTORE_CONFIG)
        - --data-dir=/var/thanos/compact
        - --debug.accept-malformed-index
        - --retention.resolution-raw=14d
        - --retention.resolution-5m=1s
        - --retention.resolution-1h=1s
        - --delete-delay=48h
        - --downsampling.disable
        - --deduplication.replica-label=replica
        env:
        - name: OBJSTORE_CONFIG
          valueFrom:
            secretKeyRef:
              key: thanos.yaml
              name: thanos-objectstorage
        image: quay.io/thanos/thanos:v0.17.1
        livenessProbe:
          failureThreshold: 4
          httpGet:
            path: /-/healthy
            port: 10902
            scheme: HTTP
          periodSeconds: 30
        name: thanos-compact
        ports:
        - containerPort: 10902
          name: http
        readinessProbe:
          failureThreshold: 20
          httpGet:
            path: /-/ready
            port: 10902
            scheme: HTTP
          periodSeconds: 5
        resources: {}
        terminationMessagePolicy: FallbackToLogsOnError
        volumeMounts:
        - mountPath: /var/thanos/compact
          name: data
          readOnly: false
      serviceAccountName: observatorium-xyz-thanos-compact
      terminationGracePeriodSeconds: 120
      volumes: []
  volumeClaimTemplates:
  - metadata:
      labels:
        app.kubernetes.io/component: database-compactor
        app.kubernetes.io/instance: observatorium-xyz
        app.kubernetes.io/name: thanos-compact
        app.kubernetes.io/part-of: observatorium
      name: data
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 50Gi
