apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app.kubernetes.io/component: compactor
    app.kubernetes.io/instance: observatorium-xyz
    app.kubernetes.io/name: loki
    app.kubernetes.io/part-of: observatorium
    app.kubernetes.io/version: 2.2.0
  name: observatorium-xyz-loki-compactor
  namespace: observatorium
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/component: compactor
      app.kubernetes.io/instance: observatorium-xyz
      app.kubernetes.io/name: loki
      app.kubernetes.io/part-of: observatorium
  serviceName: observatorium-xyz-loki-compactor-grpc
  template:
    metadata:
      labels:
        app.kubernetes.io/component: compactor
        app.kubernetes.io/instance: observatorium-xyz
        app.kubernetes.io/name: loki
        app.kubernetes.io/part-of: observatorium
    spec:
      containers:
      - args:
        - -target=compactor
        - -config.file=/etc/loki/config/config.yaml
        - -limits.per-user-override-config=/etc/loki/config/overrides.yaml
        - -log.level=error
        - -s3.url=$(S3_URL)
        - -s3.force-path-style=true
        - -distributor.replication-factor=1
        env:
        - name: S3_URL
          valueFrom:
            secretKeyRef:
              key: endpoint
              name: loki-objectstorage
        image: docker.io/grafana/loki:2.2.0
        livenessProbe:
          failureThreshold: 10
          httpGet:
            path: /metrics
            port: 3100
            scheme: HTTP
          periodSeconds: 30
        name: observatorium-xyz-loki-compactor
        ports:
        - containerPort: 3100
          name: metrics
        - containerPort: 9095
          name: grpc
        readinessProbe:
          httpGet:
            path: /ready
            port: 3100
            scheme: HTTP
          initialDelaySeconds: 15
          timeoutSeconds: 1
        resources:
          limits:
            cpu: 200m
            memory: 200Mi
          requests:
            cpu: 100m
            memory: 100Mi
        volumeMounts:
        - mountPath: /etc/loki/config/
          name: config
          readOnly: false
        - mountPath: /data
          name: storage
          readOnly: false
      volumes:
      - configMap:
          name: observatorium-xyz-loki
        name: config
  volumeClaimTemplates:
  - metadata:
      labels:
        app.kubernetes.io/instance: observatorium-xyz
        app.kubernetes.io/name: loki
        app.kubernetes.io/part-of: observatorium
      name: storage
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 250Mi
