From 905784669d8ff290626b63f33ff3220f14800621 Mon Sep 17 00:00:00 2001 From: Fabien Culpo Date: Tue, 11 Jun 2024 09:59:20 +0200 Subject: [PATCH] Helm - allow loading all alloy files in /etc/alloy --- operations/helm/charts/alloy/CHANGELOG.md | 4 ++++ operations/helm/charts/alloy/README.md | 3 ++- .../helm/charts/alloy/templates/containers/_agent.yaml | 4 ++++ operations/helm/charts/alloy/values.yaml | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/operations/helm/charts/alloy/CHANGELOG.md b/operations/helm/charts/alloy/CHANGELOG.md index 82781cb1f3..d72ab55b30 100644 --- a/operations/helm/charts/alloy/CHANGELOG.md +++ b/operations/helm/charts/alloy/CHANGELOG.md @@ -10,6 +10,10 @@ internal API changes are not present. Unreleased ---------- +### Features + +- Alloy can load all river files located in `/etc/alloy` (mounted via default or user provided configMap) instead of only one. This allows increased modularity, besides modules, and a terraform like behaviour. To enable it, set `.Values.alloy.loadFolder` to `true`. (@fculpo) + 0.3.2 (2024-05-30) ------------------ diff --git a/operations/helm/charts/alloy/README.md b/operations/helm/charts/alloy/README.md index d441424e0d..4e6faa5920 100644 --- a/operations/helm/charts/alloy/README.md +++ b/operations/helm/charts/alloy/README.md @@ -37,7 +37,7 @@ useful if just using the default DaemonSet isn't sufficient. | alloy.clustering.portName | string | `"http"` | Name for the port used for clustering, useful if running inside an Istio Mesh | | alloy.configMap.content | string | `""` | Content to assign to the new ConfigMap. This is passed into `tpl` allowing for templating from values. | | alloy.configMap.create | bool | `true` | Create a new ConfigMap for the config file. | -| alloy.configMap.key | string | `nil` | Key in ConfigMap to get config from. | +| alloy.configMap.key | string | `nil` | Key in ConfigMap to get config from. Ignored if loadFolder is true. | | alloy.configMap.name | string | `nil` | Name of existing ConfigMap to use. Used when create is false. | | alloy.enableReporting | bool | `true` | Enables sending Grafana Labs anonymous usage stats to help improve Grafana Alloy. | | alloy.envFrom | list | `[]` | Maps all the keys on a ConfigMap or Secret as environment variables. https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#envfromsource-v1-core | @@ -47,6 +47,7 @@ useful if just using the default DaemonSet isn't sufficient. | alloy.listenAddr | string | `"0.0.0.0"` | Address to listen for traffic on. 0.0.0.0 exposes the UI to other containers. | | alloy.listenPort | int | `12345` | Port to listen for traffic on. | | alloy.listenScheme | string | `"HTTP"` | Scheme is needed for readiness probes. If enabling tls in your configs, set to "HTTPS" | +| alloy.loadFolder | bool | `false` | If true, agent will load all files in /etc/alloy. alloy.configMap.key will be ignored | | alloy.mounts.dockercontainers | bool | `false` | Mount /var/lib/docker/containers from the host into the container for log collection. | | alloy.mounts.extra | list | `[]` | Extra volume mounts to add into the Grafana Alloy container. Does not affect the watch container. | | alloy.mounts.varlog | bool | `false` | Mount /var/log from the host into the container for log collection. | diff --git a/operations/helm/charts/alloy/templates/containers/_agent.yaml b/operations/helm/charts/alloy/templates/containers/_agent.yaml index 721b84e7f3..5c78f7c2e6 100644 --- a/operations/helm/charts/alloy/templates/containers/_agent.yaml +++ b/operations/helm/charts/alloy/templates/containers/_agent.yaml @@ -5,7 +5,11 @@ imagePullPolicy: {{ .Values.image.pullPolicy }} args: - run + {{- if .Values.alloy.loadFolder }} + - /etc/alloy/ + {{- else }} - /etc/alloy/{{ include "alloy.config-map.key" . }} + {{- end }} - --storage.path={{ $values.storagePath }} - --server.http.listen-addr={{ $values.listenAddr }}:{{ $values.listenPort }} - --server.http.ui-path-prefix={{ $values.uiPathPrefix }} diff --git a/operations/helm/charts/alloy/values.yaml b/operations/helm/charts/alloy/values.yaml index bd306fc273..c8416dd847 100644 --- a/operations/helm/charts/alloy/values.yaml +++ b/operations/helm/charts/alloy/values.yaml @@ -26,6 +26,10 @@ crds: ## chart, this field may also be called "agent". Naming this field "agent" is ## deprecated and will be removed in a future release. alloy: + # -- If true, agent will load all files in /etc/alloy. + # alloy.configMap.key will be ignored + loadFolder: false + configMap: # -- Create a new ConfigMap for the config file. create: true @@ -35,6 +39,7 @@ alloy: # -- Name of existing ConfigMap to use. Used when create is false. name: null # -- Key in ConfigMap to get config from. + # Ignored if loadFolder is true. key: null clustering: