From 217a914f98188cbbd31e51bd9b8e0da0d1366e17 Mon Sep 17 00:00:00 2001 From: Teddy Andrieux Date: Tue, 29 Nov 2022 13:34:54 +0100 Subject: [PATCH] helm/loki: Allow to override default loki `target` (#7791) **What this PR does / why we need it**: Add the ability to change the Loki `target` argument. E.g. one might want to use the single-binary which has target `all` but also the `table-manager` which is not part of it. So one can override the target with `all,table-manager`. **Which issue(s) this PR fixes**: Fixes #7788 **Special notes for your reviewer**: **Checklist** - [x] Reviewed the `CONTRIBUTING.md` guide - [x] `CHANGELOG.md` updated --- docs/sources/installation/helm/reference.md | 37 +++++++++++++++++++ production/helm/loki/CHANGELOG.md | 4 ++ production/helm/loki/Chart.yaml | 2 +- production/helm/loki/README.md | 2 +- .../loki/templates/read/statefulset-read.yaml | 2 +- .../templates/single-binary/statefulset.yaml | 2 +- .../loki/templates/tokengen/job-tokengen.yaml | 2 +- .../templates/write/statefulset-write.yaml | 2 +- production/helm/loki/values.yaml | 8 ++++ 9 files changed, 55 insertions(+), 6 deletions(-) diff --git a/docs/sources/installation/helm/reference.md b/docs/sources/installation/helm/reference.md index 3fe6731d04..2f5d26b42a 100644 --- a/docs/sources/installation/helm/reference.md +++ b/docs/sources/installation/helm/reference.md @@ -324,6 +324,7 @@ null "runAsNonRoot": true, "runAsUser": 10001 }, + "targetModule": "tokengen", "tolerations": [] } @@ -413,6 +414,15 @@ true "runAsUser": 10001 } + + + + enterprise.tokengen.targetModule + string + Comma-separated list of Loki modules to load for tokengen +
+"tokengen"
+
@@ -2519,6 +2529,15 @@ null
 {}
 
+ + + + read.targetModule + string + Comma-separated list of Loki modules to load for the read +
+"read"
+
@@ -2789,6 +2808,15 @@ null
 {}
 
+ + + + singleBinary.targetModule + string + Comma-separated list of Loki modules to load for the single binary +
+"all"
+
@@ -3094,6 +3122,15 @@ null
 {}
 
+ + + + write.targetModule + string + Comma-separated list of Loki modules to load for the write +
+"write"
+
diff --git a/production/helm/loki/CHANGELOG.md b/production/helm/loki/CHANGELOG.md index 11ffa80eb2..98cd1079bb 100644 --- a/production/helm/loki/CHANGELOG.md +++ b/production/helm/loki/CHANGELOG.md @@ -11,6 +11,10 @@ Entries should be ordered as follows: Entries should include a reference to the pull request that introduced the change. +## 3.4.3 + +- [ENHANCEMENT] Allow to change Loki `-target` argument + ## 3.4.2 - [BUGFIX] Fix read-only /tmp in single-binary mode diff --git a/production/helm/loki/Chart.yaml b/production/helm/loki/Chart.yaml index 89efe814ee..258ad62dd0 100644 --- a/production/helm/loki/Chart.yaml +++ b/production/helm/loki/Chart.yaml @@ -4,7 +4,7 @@ name: loki description: Helm chart for Grafana Loki in simple, scalable mode type: application appVersion: 2.6.1 -version: 3.4.2 +version: 3.4.3 home: https://grafana.github.io/helm-charts sources: - https://github.com/grafana/loki diff --git a/production/helm/loki/README.md b/production/helm/loki/README.md index 896a3a75b5..d8f07175cb 100644 --- a/production/helm/loki/README.md +++ b/production/helm/loki/README.md @@ -1,6 +1,6 @@ # loki -![Version: 3.4.2](https://img.shields.io/badge/Version-3.4.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.6.1](https://img.shields.io/badge/AppVersion-2.6.1-informational?style=flat-square) +![Version: 3.4.3](https://img.shields.io/badge/Version-3.4.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.6.1](https://img.shields.io/badge/AppVersion-2.6.1-informational?style=flat-square) Helm chart for Grafana Loki in simple, scalable mode diff --git a/production/helm/loki/templates/read/statefulset-read.yaml b/production/helm/loki/templates/read/statefulset-read.yaml index 06bca619f5..e777469d67 100644 --- a/production/helm/loki/templates/read/statefulset-read.yaml +++ b/production/helm/loki/templates/read/statefulset-read.yaml @@ -61,7 +61,7 @@ spec: imagePullPolicy: {{ .Values.loki.image.pullPolicy }} args: - -config.file=/etc/loki/config/config.yaml - - -target=read + - -target={{ .Values.read.targetModule }} {{- with .Values.read.extraArgs }} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/production/helm/loki/templates/single-binary/statefulset.yaml b/production/helm/loki/templates/single-binary/statefulset.yaml index 1c4dbb3017..30dccc6776 100644 --- a/production/helm/loki/templates/single-binary/statefulset.yaml +++ b/production/helm/loki/templates/single-binary/statefulset.yaml @@ -52,7 +52,7 @@ spec: imagePullPolicy: {{ .Values.loki.image.pullPolicy }} args: - -config.file=/etc/loki/config/config.yaml - - -target=all + - -target={{ .Values.singleBinary.targetModule }} {{- with .Values.singleBinary.extraArgs }} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/production/helm/loki/templates/tokengen/job-tokengen.yaml b/production/helm/loki/templates/tokengen/job-tokengen.yaml index ec7cffddc4..489e550003 100644 --- a/production/helm/loki/templates/tokengen/job-tokengen.yaml +++ b/production/helm/loki/templates/tokengen/job-tokengen.yaml @@ -46,7 +46,7 @@ spec: imagePullPolicy: {{ .Values.loki.image.pullPolicy }} args: - -config.file=/etc/loki/config/config.yaml - - -target=tokengen + - -target={{ .Values.enterprise.tokengen.targetModule }} - -tokengen.token-file=/shared/admin-token {{- with .Values.enterprise.tokengen.extraArgs }} {{- toYaml . | nindent 12 }} diff --git a/production/helm/loki/templates/write/statefulset-write.yaml b/production/helm/loki/templates/write/statefulset-write.yaml index 82c8a374e0..d09a1dfb08 100644 --- a/production/helm/loki/templates/write/statefulset-write.yaml +++ b/production/helm/loki/templates/write/statefulset-write.yaml @@ -53,7 +53,7 @@ spec: imagePullPolicy: {{ .Values.loki.image.pullPolicy }} args: - -config.file=/etc/loki/config/config.yaml - - -target=write + - -target={{ .Values.write.targetModule }} {{- with .Values.write.extraArgs }} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml index e0336eec53..0af1434b6c 100644 --- a/production/helm/loki/values.yaml +++ b/production/helm/loki/values.yaml @@ -335,6 +335,8 @@ enterprise: tokengen: # -- Whether the job should be part of the deployment enabled: true + # -- Comma-separated list of Loki modules to load for tokengen + targetModule: "tokengen" # -- Additional CLI arguments for the `tokengen` target extraArgs: [] # -- Additional Kubernetes environment @@ -747,6 +749,8 @@ write: selectorLabels: {} # -- Labels for ingestor service serviceLabels: {} + # -- Comma-separated list of Loki modules to load for the write + targetModule: "write" # -- Additional CLI args for the write extraArgs: [] # -- Environment variables to add to the write pods @@ -818,6 +822,8 @@ read: selectorLabels: {} # -- Labels for read service serviceLabels: {} + # -- Comma-separated list of Loki modules to load for the read + targetModule: "read" # -- Additional CLI args for the read extraArgs: [] # -- Environment variables to add to the read pods @@ -885,6 +891,8 @@ singleBinary: podAnnotations: {} # -- Additional selecto labels for each `single binary` pod selectorLabels: {} + # -- Comma-separated list of Loki modules to load for the single binary + targetModule: "all" # -- Labels for single binary service extraArgs: [] # -- Environment variables to add to the single binary pods