diff --git a/docs/sources/setup/install/helm/reference.md b/docs/sources/setup/install/helm/reference.md index f608cd91c2..061f3aaa41 100644 --- a/docs/sources/setup/install/helm/reference.md +++ b/docs/sources/setup/install/helm/reference.md @@ -4505,10 +4505,10 @@ true extraObjects - list + string
-[]
+null
 
diff --git a/production/helm/loki/CHANGELOG.md b/production/helm/loki/CHANGELOG.md index 67c9489067..2498267559 100644 --- a/production/helm/loki/CHANGELOG.md +++ b/production/helm/loki/CHANGELOG.md @@ -13,6 +13,8 @@ Entries should include a reference to the pull request that introduced the chang ## Unreleased +- [ENHANCEMENT] Expand `extraObjects` to have more flexibility in templating [#13252](https://github.com/grafana/loki/pull/13252) + ## 6.38.0 - [FEATURE] Make access modes for persistence on all PVCs and StatefulSets editable [#13474](https://github.com/grafana/loki/pull/13474) diff --git a/production/helm/loki/templates/extra-manifests.yaml b/production/helm/loki/templates/extra-manifests.yaml index c7334a57e3..87b019f0b1 100644 --- a/production/helm/loki/templates/extra-manifests.yaml +++ b/production/helm/loki/templates/extra-manifests.yaml @@ -1,8 +1,15 @@ -{{- range .Values.extraObjects }} +{{- /* Normalize extraObjects to a list, easier to loop over */ -}} +{{- $extraObjects := .Values.extraObjects | default (list) -}} + +{{- if kindIs "map" $extraObjects -}} + {{- $extraObjects = values $extraObjects -}} +{{- end -}} + +{{- range $extraObjects }} --- -{{ if kindIs "map" . }} -{{ tpl (toYaml .) $ }} -{{ else }} -{{ tpl . $ }} -{{ end }} + {{- if kindIs "map" . }} + {{- tpl (toYaml .) $ | nindent 0 }} + {{- else if kindIs "string" . }} + {{- tpl . $ | nindent 0 }} + {{- end }} {{- end }} diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml index 19cf52869c..619f6d8c45 100644 --- a/production/helm/loki/values.yaml +++ b/production/helm/loki/values.yaml @@ -3815,9 +3815,11 @@ minio: memory: 128Mi # 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: [] + +# Create extra manifests via values +# Can be a list or dictionary, both are passed through `tpl`. If dict, keys are ignored and only values are used. +# Objects can also be defined as multiline strings, useful for templating field names +extraObjects: null # - apiVersion: v1 # kind: ConfigMap # metadata: