Skip to content

Commit

Permalink
Always call tpl outside of with blocks to preserve backwards compatib…
Browse files Browse the repository at this point in the history
…ility

Signed-off-by: Pete Wall <[email protected]>
  • Loading branch information
petewall committed Jun 4, 2024
1 parent 7500956 commit 88d0c1e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions charts/k8s-monitoring/templates/_configs.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
{{- include "alloy.config.logging" .Values.alloy.logging}}

{{- if .Values.extraConfig }}
{{- tpl .Values.extraConfig . | indent 0 }}
{{- tpl .Values.extraConfig $ | indent 0 }}
{{- end }}
{{- end -}}

Expand All @@ -107,7 +107,7 @@
{{- include "alloy.config.logging" (index .Values "alloy-events").logging }}

{{- if .Values.logs.cluster_events.extraConfig }}
{{- tpl .Values.logs.cluster_events.extraConfig . | indent 0 }}
{{- tpl .Values.logs.cluster_events.extraConfig $ | indent 0 }}
{{- end }}
{{- end -}}

Expand All @@ -120,7 +120,7 @@
{{- include "alloy.config.logging" (index .Values "alloy-logs").logging }}

{{- if .Values.logs.extraConfig }}
{{- tpl .Values.logs.extraConfig . | indent 0 }}
{{- tpl .Values.logs.extraConfig $ | indent 0 }}
{{- end }}
{{- end -}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ loki.source.kubernetes_events "cluster_events" {
}

loki.process "cluster_events" {
{{- if .extraStageBlocks }}
{{ tpl .extraStageBlocks . | indent 2 }}
{{- end }} {{/* Avoid calling tpl inside of a with block, makes for better backwards compatibility */}}
{{- if .Values.logs.cluster_events.extraStageBlocks }}
{{ tpl .Values.logs.cluster_events.extraStageBlocks $ | indent 2 }}
{{- end }}
forward_to = [
loki.process.logs_service.receiver,
{{- with .Values.logs.cluster_events }}
{{- if .logToStdout }}
loki.echo.cluster_events.receiver,
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ loki.source.podlogs "podlogs_objects" {

loki.process "podlogs_objects" {
{{- if .Values.logs.podLogsObjects.extraStageBlocks }}
{{ tpl .Values.logs.podLogsObjects.extraStageBlocks . | indent 2 }}
{{ tpl .Values.logs.podLogsObjects.extraStageBlocks $ | indent 2 }}
{{- end }}
forward_to = [loki.process.logs_service.receiver]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ loki.process "pod_logs" {
}

{{- if .Values.logs.pod_logs.extraStageBlocks }}
{{ tpl .Values.logs.pod_logs.extraStageBlocks . | indent 2 }}
{{ tpl .Values.logs.pod_logs.extraStageBlocks $ | indent 2 }}
{{ end }}
forward_to = [loki.process.logs_service.receiver]
}
Expand Down

0 comments on commit 88d0c1e

Please sign in to comment.