From af5be900764acfe4bff54ceef164a4f660990f8a Mon Sep 17 00:00:00 2001 From: TheRealNoob Date: Tue, 30 Apr 2024 02:33:02 -0700 Subject: [PATCH] feat(helm): Allow extraObject items as multiline strings (#12397) Co-authored-by: Michel Hollands <42814411+MichelHollands@users.noreply.github.com> --- production/helm/loki/CHANGELOG.md | 4 ++++ production/helm/loki/Chart.yaml | 2 +- production/helm/loki/README.md | 2 +- production/helm/loki/templates/_helpers.tpl | 2 +- production/helm/loki/templates/extra-manifests.yaml | 8 ++++++-- production/helm/loki/values.yaml | 12 ++++++++++++ 6 files changed, 25 insertions(+), 5 deletions(-) diff --git a/production/helm/loki/CHANGELOG.md b/production/helm/loki/CHANGELOG.md index 0b9df02241ef..5d24c009e0f5 100644 --- a/production/helm/loki/CHANGELOG.md +++ b/production/helm/loki/CHANGELOG.md @@ -13,6 +13,10 @@ Entries should include a reference to the pull request that introduced the chang [//]: # ( : do not remove this line. This locator is used by the CI pipeline to automatically create a changelog entry for each new Loki release. Add other chart versions and respective changelog entries bellow this line.) +## 6.4.0 + +- [ENHANCEMENT] Allow extraObject items as multiline strings, allowing for templating field names + ## 6.3.4 - [BUGFIX] Add missing OTLP endpoint to nginx config diff --git a/production/helm/loki/Chart.yaml b/production/helm/loki/Chart.yaml index 08d0fe98332c..791a9971242c 100644 --- a/production/helm/loki/Chart.yaml +++ b/production/helm/loki/Chart.yaml @@ -3,7 +3,7 @@ name: loki description: Helm chart for Grafana Loki in simple, scalable mode type: application appVersion: 3.0.0 -version: 6.3.4 +version: 6.4.0 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 26fb34fd39f7..e3cf5f9f7689 100644 --- a/production/helm/loki/README.md +++ b/production/helm/loki/README.md @@ -1,6 +1,6 @@ # loki -![Version: 6.3.4](https://img.shields.io/badge/Version-6.3.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.0.0](https://img.shields.io/badge/AppVersion-3.0.0-informational?style=flat-square) +![Version: 6.4.0](https://img.shields.io/badge/Version-6.4.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.0.0](https://img.shields.io/badge/AppVersion-3.0.0-informational?style=flat-square) Helm chart for Grafana Loki in simple, scalable mode diff --git a/production/helm/loki/templates/_helpers.tpl b/production/helm/loki/templates/_helpers.tpl index e8107efdeea0..7e618fb97de0 100644 --- a/production/helm/loki/templates/_helpers.tpl +++ b/production/helm/loki/templates/_helpers.tpl @@ -931,7 +931,7 @@ enableServiceLinks: false {{/* Determine compactor address based on target configuration */}} {{- define "loki.compactorAddress" -}} {{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}} -{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true "-}} +{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}} {{- $isSingleBinary := eq (include "loki.deployment.isSingleBinary" .) "true" -}} {{- $compactorAddress := include "loki.backendFullname" . -}} {{- if and $isSimpleScalable .Values.read.legacyReadTarget -}} diff --git a/production/helm/loki/templates/extra-manifests.yaml b/production/helm/loki/templates/extra-manifests.yaml index a9bb3b6ba8ef..e661b6567aee 100644 --- a/production/helm/loki/templates/extra-manifests.yaml +++ b/production/helm/loki/templates/extra-manifests.yaml @@ -1,4 +1,8 @@ -{{ range .Values.extraObjects }} +{{- range .Values.extraObjects -}} --- +{{- if kindIs "map" . }} {{ tpl (toYaml .) $ }} -{{ end }} +{{- else }} +{{ tpl . $ }} +{{- end }} +{{- end }} diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml index 8b48e8f0949f..1ca9d916e41b 100644 --- a/production/helm/loki/values.yaml +++ b/production/helm/loki/values.yaml @@ -3086,6 +3086,7 @@ minio: # Allow the address used by Loki to refer to Minio to be overridden address: null # Create extra manifests via values. Would be passed through `tpl` for templating +# objects can also be provided as multiline strings, useful for templating field names extraObjects: [] # - apiVersion: v1 # kind: ConfigMap @@ -3105,6 +3106,17 @@ extraObjects: [] # category: logs # annotations: # message: "loki has encountered errors" +# - | +# apiVersion: v1 +# kind: Secret +# type: Opaque +# metadata: +# name: loki-distributed-basic-auth +# data: +# {{- range .Values.loki.tenants }} +# {{ .name }}: {{ b64enc .password | quote }} +# {{- end }} + sidecar: image: