apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: loki
  namespace: argocd
  annotations:
    argocd.argoproj.io/sync-wave: "0"
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: default
  source:
    repoURL: https://grafana.github.io/helm-charts
    chart: loki
    targetRevision: "7.0.0"
    helm:
      values: |
        deploymentMode: SingleBinary

        write:
          replicas: 0
        read:
          replicas: 0
        backend:
          replicas: 0

        loki:
          auth_enabled: false
          storage:
            bucketNames:
              chunks: chunks
              ruler: ruler
              admin: admin
            type: filesystem
            filesystem:
              chunks_directory: /var/loki/chunks
              rules_directory: /var/loki/rules
          structuredConfig:
            auth_enabled: false

            server:
              http_listen_port: 3100
              grpc_listen_port: 9095

            common:
              path_prefix: /var/loki
              replication_factor: 1

            schema_config:
              configs:
                - from: "2025-01-01"
                  store: tsdb
                  object_store: filesystem
                  schema: v13
                  index:
                    prefix: index_
                    period: 24h

            limits_config:
              retention_period: 30d
              reject_old_samples: true
              reject_old_samples_max_age: 168h

        chunksCache:
          enabled: false
        resultsCache:
          enabled: false
        gateway:
          enabled: false
        test:
          enabled: false
        lokiCanary:
          enabled: false

        singleBinary:
          replicas: 1
          persistence:
            enabled: true
            size: 20Gi
          resources:
            requests:
              cpu: 100m
              memory: 256Mi
            limits:
              cpu: 500m
              memory: 1Gi

  destination:
    server: https://kubernetes.default.svc
    namespace: metrics
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
