From f62e3630752a7ed86436c2968607ed93b9152d4a Mon Sep 17 00:00:00 2001 From: TheRealNoob Date: Mon, 3 Jun 2024 00:32:27 -0700 Subject: [PATCH 1/3] [pmm] add extraObjects --- charts/pmm/templates/extraObjects.yaml | 8 ++++++++ charts/pmm/values.yaml | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 charts/pmm/templates/extraObjects.yaml diff --git a/charts/pmm/templates/extraObjects.yaml b/charts/pmm/templates/extraObjects.yaml new file mode 100644 index 00000000..e652e463 --- /dev/null +++ b/charts/pmm/templates/extraObjects.yaml @@ -0,0 +1,8 @@ +{{- range .Values.extraObjects -}} +--- +{{- if kindIs "map" . }} +{{ tpl (toYaml .) $ }} +{{- else }} +{{ tpl . $ }} +{{- end }} +{{- end }} diff --git a/charts/pmm/values.yaml b/charts/pmm/values.yaml index 7e27b82a..29d1b789 100644 --- a/charts/pmm/values.yaml +++ b/charts/pmm/values.yaml @@ -265,3 +265,7 @@ extraVolumeMounts: [] ## @param extraVolumes Optionally specify extra list of additional volumes ## extraVolumes: [] +## @param extraObjects Optionally specify extra list of additional objects to create +## +extraObjects: [] + From 10b31024d5df005e9f1a4a15706bcdd17b4f4639 Mon Sep 17 00:00:00 2001 From: TheRealNoob Date: Mon, 3 Jun 2024 00:40:03 -0700 Subject: [PATCH 2/3] bump chart version --- charts/pmm/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/pmm/Chart.yaml b/charts/pmm/Chart.yaml index 333e687a..a82b7a7b 100644 --- a/charts/pmm/Chart.yaml +++ b/charts/pmm/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: pmm description: A Helm chart for Percona Monitoring and Management (PMM) type: application -version: 1.3.13 +version: 1.4.0 appVersion: "2.41.2" home: https://github.com/percona/pmm maintainers: From 2fd9635b7213c3b8e1c70092928136642e33a0e5 Mon Sep 17 00:00:00 2001 From: TheRealNoob Date: Sat, 8 Jun 2024 08:09:30 -0500 Subject: [PATCH 3/3] allow extraObjects as list or dict --- charts/pmm/templates/extraObjects.yaml | 20 ++++++++++++++++-- charts/pmm/values.yaml | 29 +++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/charts/pmm/templates/extraObjects.yaml b/charts/pmm/templates/extraObjects.yaml index e652e463..cf4551ab 100644 --- a/charts/pmm/templates/extraObjects.yaml +++ b/charts/pmm/templates/extraObjects.yaml @@ -1,8 +1,24 @@ -{{- range .Values.extraObjects -}} +{{- /* Define extraObjects to handle both list and map scenarios */ -}} +{{- $extraObjects := .Values.extraObjects }} + +{{- if not (kindIs "slice" .Values.extraObjects) }} + {{- if kindIs "map" .Values.extraObjects }} + {{- $extraObjects = list }} + {{- range $key, $value := .Values.extraObjects }} + {{- $extraObjects = append $extraObjects $value }} + {{- end }} + {{- else }} + {{- fail ".Values.extraObjects must be a list or dictionary object" }} + {{- end }} +{{- end }} + +{{- range $extraObjects }} --- {{- if kindIs "map" . }} {{ tpl (toYaml .) $ }} -{{- else }} +{{- else if kindIs "string" . }} {{ tpl . $ }} +{{- else }} +{{- fail "grandchilden of .Values.extraObjects must be a dictionary or string" }} {{- end }} {{- end }} diff --git a/charts/pmm/values.yaml b/charts/pmm/values.yaml index 29d1b789..3722f70b 100644 --- a/charts/pmm/values.yaml +++ b/charts/pmm/values.yaml @@ -265,7 +265,30 @@ extraVolumeMounts: [] ## @param extraVolumes Optionally specify extra list of additional volumes ## extraVolumes: [] -## @param extraObjects Optionally specify extra list of additional objects to create -## -extraObjects: [] +## @param extraObjects Optional set of manifests to deploy +## Can be defined as either a list of dictionary +## List objects can template keys, but doesn't support merging from multiple values files. +## Dictionaries can't template keys, but can merge values files which makes it better suited for use with encrypted and unencrypted values files. +extraObjects: [] +# meaningless_key: +# apiVersion: v1 +# kind: Secret +# type: Opaque +# metadata: +# name: configmap +# data: +# token: | +# {{ print "public configmap" | b64enc }} +# - | +# {{- range (list "1" "2" "3") }} +# --- +# apiVersion: v1 +# kind: Secret +# type: Opaque +# metadata: +# name: google-serviceaccount +# data: +# {{ printf "secret-%s" . }}: | +# {{ print "super secret password" | b64enc }} +# {{- end }}