From dd9219f2935eb82ad0fa6b2de3c2e5fb870d8a3f Mon Sep 17 00:00:00 2001 From: Thomas Wessner Date: Mon, 6 Jan 2025 10:57:03 +0100 Subject: [PATCH 1/4] [common]: enable mounting of existing cm Signed-off-by: Thomas Wessner --- charts/common/Chart.yaml | 2 +- charts/common/README.md | 2 +- charts/common/templates/_pod.yaml | 9 ++++++++- charts/common/values.schema.json | 19 +++++++++++++++++++ charts/common/values.yaml | 7 ++++++- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index c1955fcf..04fafb52 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: common description: "Bedag's common Helm chart to use for creating other Helm charts" -version: 12.1.0 +version: 13.0.0 # A chart can be either an 'application' or a 'library' chart. # # Application charts are a collection of templates that can be packaged into versioned archives diff --git a/charts/common/README.md b/charts/common/README.md index 28949f50..d2be0002 100644 --- a/charts/common/README.md +++ b/charts/common/README.md @@ -1,6 +1,6 @@ # common -![Version: 12.1.0](https://img.shields.io/badge/Version-12.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 13.0.0](https://img.shields.io/badge/Version-13.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) Bedag's common Helm chart to use for creating other Helm charts diff --git a/charts/common/templates/_pod.yaml b/charts/common/templates/_pod.yaml index b2c53e5f..e1a8c5f8 100644 --- a/charts/common/templates/_pod.yaml +++ b/charts/common/templates/_pod.yaml @@ -65,9 +65,16 @@ volumes: {{- end }} {{- else if eq .type "configMap" }} configMap: - name: {{ template "library.name" $root }}-{{ .name }} {{- if .defaultMode }} + name: {{ template "library.name" $root }}-{{ .name }} defaultMode: {{ .defaultMode }} + {{- else }} + name: {{ .name }} + items: + {{- range .items }} + - key: {{ .key }} + path: {{ .path }} + {{- end }} {{- end }} {{- else if eq .type "persistentVolumeClaim" }} persistentVolumeClaim: diff --git a/charts/common/values.schema.json b/charts/common/values.schema.json index c457c05c..21a11630 100644 --- a/charts/common/values.schema.json +++ b/charts/common/values.schema.json @@ -1090,6 +1090,25 @@ "type": "array", "items": { "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "items": { + "type": "array", + "properties": { + "key": { + "type": "string" + }, + "path": { + "type": "string" + } + } + } + }, "required": [ "name", "type" diff --git a/charts/common/values.yaml b/charts/common/values.yaml index e030ce8f..291fe837 100644 --- a/charts/common/values.yaml +++ b/charts/common/values.yaml @@ -465,9 +465,14 @@ components: # volumes is a list of volumes to be created as secret or configMap volumes: [] # -- name of the volume - # - name: generic-name + # - name: generic-name or existing-cm-name # -- type can either be "secret", "configMap", "persistentVolumeClaim", "emptyDir", "external" or "csi" # type: "secret" + # START ONLY FOR CONFIGMAP + # items: + # - key: foo.txt + # path: opt/foo.txt + # END ONLY FOR CONFIGMAP # START ONLY FOR SECRET or CONFIGMAP # filePath is optional for specifying a filePath in the helm chart where the file is located. # filePath: "files/xy.yml" From 94581295ff009c3552d1debd64f058dd92e5bb08 Mon Sep 17 00:00:00 2001 From: Thomas Wessner Date: Mon, 6 Jan 2025 10:57:42 +0100 Subject: [PATCH 2/4] [common]: enable mounting of existing cm Signed-off-by: Thomas Wessner --- charts/common/README.md | 1 + charts/common/README.md.gotmpl | 1 + 2 files changed, 2 insertions(+) diff --git a/charts/common/README.md b/charts/common/README.md index d2be0002..b7dd9afb 100644 --- a/charts/common/README.md +++ b/charts/common/README.md @@ -25,6 +25,7 @@ Major Changes to functions are documented with the version affected. **Before up |networkpolicy template changes|10.0.0|add possibility to create multiple networkpolicies|https://github.com/bedag/helm-charts/pull/77| |ingress template changes|11.0.0|add possibility to create multiple ingress objects|https://github.com/bedag/helm-charts/pull/134 |ingress template changes|12.0.0|support defining multiple hosts and secrets for one ingress|https://github.com/bedag/helm-charts/pull/138 +|pod template changes|13.0.0|add possibility to mount an existing configmap|https://github.com/bedag/helm-charts/pull/147 # Values by Component diff --git a/charts/common/README.md.gotmpl b/charts/common/README.md.gotmpl index 42bf92a2..7a9e65b5 100644 --- a/charts/common/README.md.gotmpl +++ b/charts/common/README.md.gotmpl @@ -34,6 +34,7 @@ Major Changes to functions are documented with the version affected. **Before up |networkpolicy template changes|10.0.0|add possibility to create multiple networkpolicies|https://github.com/bedag/helm-charts/pull/77| |ingress template changes|11.0.0|add possibility to create multiple ingress objects|https://github.com/bedag/helm-charts/pull/134 |ingress template changes|12.0.0|support defining multiple hosts and secrets for one ingress|https://github.com/bedag/helm-charts/pull/138 +|pod template changes|13.0.0|add possibility to mount an existing configmap|https://github.com/bedag/helm-charts/pull/147 {{/* Chart Values */}} From 07e8e4aa2eb1fe9adebec22676a5ab35f632e97f Mon Sep 17 00:00:00 2001 From: Thomas Wessner Date: Mon, 6 Jan 2025 14:58:27 +0100 Subject: [PATCH 3/4] [common]: update version number and enable the feature when items is set Signed-off-by: Thomas Wessner --- charts/common/Chart.yaml | 2 +- charts/common/README.md | 2 +- charts/common/templates/_pod.yaml | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index 04fafb52..3e5b1373 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: common description: "Bedag's common Helm chart to use for creating other Helm charts" -version: 13.0.0 +version: 12.2.0 # A chart can be either an 'application' or a 'library' chart. # # Application charts are a collection of templates that can be packaged into versioned archives diff --git a/charts/common/README.md b/charts/common/README.md index b7dd9afb..80cc57a3 100644 --- a/charts/common/README.md +++ b/charts/common/README.md @@ -1,6 +1,6 @@ # common -![Version: 13.0.0](https://img.shields.io/badge/Version-13.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 12.2.0](https://img.shields.io/badge/Version-12.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) Bedag's common Helm chart to use for creating other Helm charts diff --git a/charts/common/templates/_pod.yaml b/charts/common/templates/_pod.yaml index e1a8c5f8..f02a6159 100644 --- a/charts/common/templates/_pod.yaml +++ b/charts/common/templates/_pod.yaml @@ -65,16 +65,18 @@ volumes: {{- end }} {{- else if eq .type "configMap" }} configMap: - {{- if .defaultMode }} - name: {{ template "library.name" $root }}-{{ .name }} - defaultMode: {{ .defaultMode }} - {{- else }} + {{- if .items }} name: {{ .name }} items: {{- range .items }} - key: {{ .key }} path: {{ .path }} {{- end }} + {{- else }} + name: {{ template "library.name" $root }}-{{ .name }} + {{- if .defaultMode }} + defaultMode: {{ .defaultMode }} + {{- end }} {{- end }} {{- else if eq .type "persistentVolumeClaim" }} persistentVolumeClaim: From b58864c09e17ca6bec9436d08d1cd5d0c20bba16 Mon Sep 17 00:00:00 2001 From: Thomas Wessner Date: Mon, 6 Jan 2025 14:59:47 +0100 Subject: [PATCH 4/4] [common]: update version number and enable the feature when items is set Signed-off-by: Thomas Wessner --- charts/common/README.md | 1 - charts/common/README.md.gotmpl | 1 - 2 files changed, 2 deletions(-) diff --git a/charts/common/README.md b/charts/common/README.md index 80cc57a3..47cfd37f 100644 --- a/charts/common/README.md +++ b/charts/common/README.md @@ -25,7 +25,6 @@ Major Changes to functions are documented with the version affected. **Before up |networkpolicy template changes|10.0.0|add possibility to create multiple networkpolicies|https://github.com/bedag/helm-charts/pull/77| |ingress template changes|11.0.0|add possibility to create multiple ingress objects|https://github.com/bedag/helm-charts/pull/134 |ingress template changes|12.0.0|support defining multiple hosts and secrets for one ingress|https://github.com/bedag/helm-charts/pull/138 -|pod template changes|13.0.0|add possibility to mount an existing configmap|https://github.com/bedag/helm-charts/pull/147 # Values by Component diff --git a/charts/common/README.md.gotmpl b/charts/common/README.md.gotmpl index 7a9e65b5..42bf92a2 100644 --- a/charts/common/README.md.gotmpl +++ b/charts/common/README.md.gotmpl @@ -34,7 +34,6 @@ Major Changes to functions are documented with the version affected. **Before up |networkpolicy template changes|10.0.0|add possibility to create multiple networkpolicies|https://github.com/bedag/helm-charts/pull/77| |ingress template changes|11.0.0|add possibility to create multiple ingress objects|https://github.com/bedag/helm-charts/pull/134 |ingress template changes|12.0.0|support defining multiple hosts and secrets for one ingress|https://github.com/bedag/helm-charts/pull/138 -|pod template changes|13.0.0|add possibility to mount an existing configmap|https://github.com/bedag/helm-charts/pull/147 {{/* Chart Values */}}