From b4a7050c89bf2288cc9948f93513f26a1306f263 Mon Sep 17 00:00:00 2001 From: Michael McLeroy Date: Wed, 31 May 2023 10:22:39 -0400 Subject: [PATCH 1/2] feat(fluentd): add support for templating volumes and initcontainers Signed-off-by: Michael McLeroy --- charts/fluentd/Chart.yaml | 2 +- charts/fluentd/templates/_pod.tpl | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/charts/fluentd/Chart.yaml b/charts/fluentd/Chart.yaml index e3a6fa6a..f19fa1a5 100644 --- a/charts/fluentd/Chart.yaml +++ b/charts/fluentd/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: fluentd description: A Helm chart for Kubernetes # type: application -version: 0.4.3 +version: 0.4.4 appVersion: v1.15.2 icon: https://www.fluentd.org/images/miscellany/fluentd-logo_2x.png home: https://www.fluentd.org/ diff --git a/charts/fluentd/templates/_pod.tpl b/charts/fluentd/templates/_pod.tpl index f77fb2f8..8fb0f0fa 100644 --- a/charts/fluentd/templates/_pod.tpl +++ b/charts/fluentd/templates/_pod.tpl @@ -15,7 +15,7 @@ terminationGracePeriodSeconds: {{ . }} {{- end }} {{- with .Values.initContainers }} initContainers: - {{- toYaml . | nindent 2 }} + {{- tpl (ternary . (toYaml .) (kindIs "string" .)) $ | trim | nindent 2 -}} {{- end }} containers: - name: {{ .Chart.Name }} @@ -76,8 +76,8 @@ containers: mountPath: /var/lib/docker/containers readOnly: true {{- end }} - {{- if .Values.volumeMounts -}} - {{- toYaml .Values.volumeMounts | nindent 4 }} + {{- with .Values.volumeMounts -}} + {{- tpl (ternary . (toYaml .) (kindIs "string" .)) $ | trim | nindent 4 -}} {{- end -}} {{- range $key := .Values.configMapConfigs }} {{- print "- name: " $key | nindent 4 }} @@ -106,8 +106,8 @@ volumes: hostPath: path: /var/lib/docker/containers {{- end }} -{{- if .Values.volumes -}} -{{- toYaml .Values.volumes | nindent 0 }} +{{- with .Values.volumes -}} +{{- tpl (ternary . (toYaml .) (kindIs "string" .)) $ | trim | nindent 0 -}} {{- end -}} {{- range $key := .Values.configMapConfigs }} {{- print "- name: " $key | nindent 0 }} From a3daa995910f5989934dc141b07209921ec00f38 Mon Sep 17 00:00:00 2001 From: Michael McLeroy Date: Thu, 1 Jun 2023 16:37:36 -0400 Subject: [PATCH 2/2] feat(fluentd): add template to podannotations Signed-off-by: Michael McLeroy --- charts/fluentd/templates/daemonset.yaml | 2 +- charts/fluentd/templates/deployment.yaml | 2 +- charts/fluentd/templates/statefulset.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/fluentd/templates/daemonset.yaml b/charts/fluentd/templates/daemonset.yaml index 1fb6f761..de3f8351 100644 --- a/charts/fluentd/templates/daemonset.yaml +++ b/charts/fluentd/templates/daemonset.yaml @@ -28,7 +28,7 @@ spec: annotations: checksum/config: {{ include (print $.Template.BasePath "/fluentd-configurations-cm.yaml") . | sha256sum }} {{- with .Values.podAnnotations }} - {{- toYaml . | nindent 8 }} + {{- tpl (ternary . (toYaml .) (kindIs "string" .)) $ | trim | nindent 8 }} {{- end }} labels: {{- include "fluentd.selectorLabels" . | nindent 8 }} diff --git a/charts/fluentd/templates/deployment.yaml b/charts/fluentd/templates/deployment.yaml index 431d2a0e..5b54d68d 100644 --- a/charts/fluentd/templates/deployment.yaml +++ b/charts/fluentd/templates/deployment.yaml @@ -29,7 +29,7 @@ spec: annotations: checksum/config: {{ include (print $.Template.BasePath "/fluentd-configurations-cm.yaml") . | sha256sum }} {{- with .Values.podAnnotations }} - {{- toYaml . | nindent 8 }} + {{- tpl (ternary . (toYaml .) (kindIs "string" .)) $ | trim | nindent 8 }} {{- end }} labels: {{- include "fluentd.selectorLabels" . | nindent 8 }} diff --git a/charts/fluentd/templates/statefulset.yaml b/charts/fluentd/templates/statefulset.yaml index 5bc22481..8316ab90 100644 --- a/charts/fluentd/templates/statefulset.yaml +++ b/charts/fluentd/templates/statefulset.yaml @@ -30,7 +30,7 @@ spec: annotations: checksum/config: {{ include (print $.Template.BasePath "/fluentd-configurations-cm.yaml") . | sha256sum }} {{- with .Values.podAnnotations }} - {{- toYaml . | nindent 8 }} + {{- tpl (ternary . (toYaml .) (kindIs "string" .)) $ | trim | nindent 8 }} {{- end }} labels: {{- include "fluentd.selectorLabels" . | nindent 8 }}