# Grafana Alloy Helm values for OSDC centralized logging.
#
# DaemonSet mode — one pod per node, collects pod logs + system journal.
# Only installed when grafana-cloud-credentials secret exists in the logging namespace.
#
# Dynamic values (LOKI_URL, CLUSTER_NAME, credentials) are injected by deploy.sh
# via a temporary override file.

fullnameOverride: alloy-logging    # Prevent RBAC collision with monitoring's Alloy

controller:
  type: daemonset

  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 50           # Allow fast rollouts across many nodes

  tolerations:
    - operator: Exists             # Run on every node type (base, GPU, BuildKit)

  volumes:
    extra:
      - name: journal
        hostPath:
          path: /var/log/journal
          type: DirectoryOrCreate
      - name: positions
        hostPath:
          path: /var/alloy-logging/positions
          type: DirectoryOrCreate

serviceAccount:
  create: true

rbac:
  create: true

alloy:
  # Note: extraEnv (GOGC, GOMEMLIMIT, LOKI_*, NODE_NAME) is set in deploy.sh's
  # runtime override file because it includes per-cluster secrets and config.
  # Helm array overrides replace entirely, so all env vars must be in one place.

  # Bind dual-stack so the kubelet readinessProbe (which targets the pod's
  # IPv6 address on IPv6-only EKS) can reach the HTTP server. Chart default
  # is 0.0.0.0 which is IPv4-only and leaves the DaemonSet stuck NotReady.
  listenAddr: "[::]"

  mounts:
    varlog: true                 # /var/log for pod logs
    dockercontainers: false      # containerd, not Docker
    extra:
      - name: journal
        mountPath: /var/log/journal
        readOnly: true
      - name: positions
        mountPath: /var/alloy-logging/positions

  resources:
    requests:
      cpu: 500m
      memory: 1Gi
    limits:
      cpu: "3"
      memory: 2Gi               # High-throughput CI nodes need headroom

  clustering:
    enabled: false               # DaemonSet — each pod handles its own node

  storagePath: /var/alloy-logging/positions
