apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app.kubernetes.io/component: ingester
    app.kubernetes.io/instance: observatorium-xyz
    app.kubernetes.io/name: loki
    app.kubernetes.io/part-of: observatorium
    app.kubernetes.io/version: 1.6.1
  name: observatorium-xyz-loki-ingester
  namespace: observatorium
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/component: ingester
      app.kubernetes.io/instance: observatorium-xyz
      app.kubernetes.io/name: loki
      app.kubernetes.io/part-of: observatorium
      loki.grafana.com/gossip: "true"
  serviceName: observatorium-xyz-loki-ingester-grpc
  template:
    metadata:
      labels:
        app.kubernetes.io/component: ingester
        app.kubernetes.io/instance: observatorium-xyz
        app.kubernetes.io/name: loki
        app.kubernetes.io/part-of: observatorium
        loki.grafana.com/gossip: "true"
    spec:
      containers:
      - args:
        - -target=ingester
        - -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
        env:
        - name: S3_URL
          valueFrom:
            secretKeyRef:
              key: endpoint
              name: loki-objectstorage
        image: docker.io/grafana/loki:1.6.1
        name: observatorium-xyz-loki-ingester
        ports:
        - containerPort: 3100
          name: metrics
        - containerPort: 9095
          name: grpc
        - containerPort: 7946
          name: gossip-ring
        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
