From 097d7501b31a6eb32232d461e7e79fdb3d9884ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=B6ran=20P=C3=B6hner?=
 <10630407+groundhog2k@users.noreply.github.com>
Date: Mon, 14 Feb 2022 14:43:06 +0100
Subject: [PATCH] Add support for extraContainers and extraInitContainers
 (#877)

---
 charts/mariadb/Chart.yaml                  | 4 ++--
 charts/mariadb/README.md                   | 4 +++-
 charts/mariadb/RELEASENOTES.md             | 1 +
 charts/mariadb/templates/statefulset.yaml  | 6 ++++++
 charts/mariadb/values.yaml                 | 6 ++++++
 charts/mongodb/Chart.yaml                  | 4 ++--
 charts/mongodb/README.md                   | 4 +++-
 charts/mongodb/RELEASENOTES.md             | 1 +
 charts/mongodb/templates/statefulset.yaml  | 6 ++++++
 charts/mongodb/values.yaml                 | 6 ++++++
 charts/postgres/Chart.yaml                 | 4 ++--
 charts/postgres/README.md                  | 4 +++-
 charts/postgres/RELEASENOTES.md            | 1 +
 charts/postgres/templates/statefulset.yaml | 6 ++++++
 charts/postgres/values.yaml                | 6 ++++++
 15 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/charts/mariadb/Chart.yaml b/charts/mariadb/Chart.yaml
index abaf7092..d6f1dd8e 100644
--- a/charts/mariadb/Chart.yaml
+++ b/charts/mariadb/Chart.yaml
@@ -7,6 +7,6 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.4.2
+version: 0.2.19
 
-appVersion: "10.7.1"
+appVersion: "10.5.3"
diff --git a/charts/mariadb/README.md b/charts/mariadb/README.md
index 9fa9387c..61803f7a 100644
--- a/charts/mariadb/README.md
+++ b/charts/mariadb/README.md
@@ -1,6 +1,6 @@
 # MariaDB
 
-![Version: 0.4.2](https://img.shields.io/badge/Version-0.4.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 10.7.1](https://img.shields.io/badge/AppVersion-10.7.1-informational?style=flat-square)
+![Version: 0.2.19](https://img.shields.io/badge/Version-0.2.19-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 10.5.3](https://img.shields.io/badge/AppVersion-10.5.3-informational?style=flat-square)
 
 ## Changelog
 
@@ -58,6 +58,8 @@ helm uninstall my-release
 | image.repository | string | `"mariadb"` | Image name |
 | image.tag | string | `""` | Image tag |
 | imagePullSecrets | list | `[]` | Image pull secrets |
+| extraInitContainers | list | `[]` | Extra init containers |
+| extaContainers | list | `[]` | Extra containers for usage as sidecars |
 | startupProbe | object | `see values.yaml` | Startup probe configuration |
 | livenessProbe | object | `see values.yaml` | Liveness probe configuration |
 | readinessProbe | object | `see values.yaml` | Readiness probe configuration |
diff --git a/charts/mariadb/RELEASENOTES.md b/charts/mariadb/RELEASENOTES.md
index 931c1a00..51300c73 100644
--- a/charts/mariadb/RELEASENOTES.md
+++ b/charts/mariadb/RELEASENOTES.md
@@ -4,6 +4,7 @@
 | :------------ | :---------- | :----------------- |
 | 0.2.17 | 10.5.13 | Implemented startupProbe support |
 | 0.2.18 | 10.5.13 | Implemented support for extra secrets and advanced configuration capabilites |
+| 0.2.19 | 10.5.13 | Implemented support for extra containers |
 | 0.3.1 | 10.6.5 | Implemented startupProbe support |
 | 0.3.2 | 10.6.5 | Implemented support for extra secrets and advanced configuration capabilites |
 | 0.4.1 | 10.7.1 | Implemented startupProbe support |
diff --git a/charts/mariadb/templates/statefulset.yaml b/charts/mariadb/templates/statefulset.yaml
index 159ce9c8..ae1287ac 100644
--- a/charts/mariadb/templates/statefulset.yaml
+++ b/charts/mariadb/templates/statefulset.yaml
@@ -65,6 +65,9 @@ spec:
             - mountPath: /configs
               name: configs
           command: [ "/initscripts/init.sh" ]
+      {{- with .Values.extraInitContainers }}
+      {{- toYaml . | nindent 8 }}
+      {{- end }}
       containers:
         - name: {{ .Chart.Name }}
           {{- with .Values.securityContext  }}
@@ -183,6 +186,9 @@ spec:
             - secretRef:
                 name: {{ . }}
           {{- end }}
+      {{- with .Values.extraContainers }}
+      {{- toYaml . | nindent 8 }}
+      {{- end }}
       {{- with .Values.nodeSelector }}
       nodeSelector:
         {{- toYaml . | nindent 8 }}
diff --git a/charts/mariadb/values.yaml b/charts/mariadb/values.yaml
index c14ac50e..48524c5f 100644
--- a/charts/mariadb/values.yaml
+++ b/charts/mariadb/values.yaml
@@ -112,6 +112,12 @@ readinessProbe:
   successThreshold: 1
   periodSeconds: 10
 
+## Extra init containers
+extraInitContainers: []
+
+## Extra containers for usage as sidecars
+extraContainers: []
+
 ## Additional environment variables
 env: []
 
diff --git a/charts/mongodb/Chart.yaml b/charts/mongodb/Chart.yaml
index d61c28ca..2dba857e 100644
--- a/charts/mongodb/Chart.yaml
+++ b/charts/mongodb/Chart.yaml
@@ -7,6 +7,6 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.4.3
+version: 0.2.17
 
-appVersion: "5.0.6"
+appVersion: "4.2.18"
diff --git a/charts/mongodb/README.md b/charts/mongodb/README.md
index 9bc126b4..aad36535 100644
--- a/charts/mongodb/README.md
+++ b/charts/mongodb/README.md
@@ -1,6 +1,6 @@
 # MongoDB
 
-![Version: 0.4.3](https://img.shields.io/badge/Version-0.4.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 5.0.6](https://img.shields.io/badge/AppVersion-5.0.6-informational?style=flat-square)
+![Version: 0.2.17](https://img.shields.io/badge/Version-0.2.17-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.2.18](https://img.shields.io/badge/AppVersion-4.2.18-informational?style=flat-square)
 
 ## Changelog
 
@@ -58,6 +58,8 @@ helm uninstall my-release
 | image.repository | string | `"mongo"` | Image name |
 | image.tag | string | `""` | Image tag |
 | imagePullSecrets | list | `[]` | Image pull secrets |
+| extraInitContainers | list | `[]` | Extra init containers |
+| extaContainers | list | `[]` | Extra containers for usage as sidecars |
 | startupProbe | object | `see values.yaml` | Startup probe configuration |
 | livenessProbe | object | `see values.yaml` | Liveness probe configuration |
 | readinessProbe | object | `see values.yaml` | Readiness probe configuration |
diff --git a/charts/mongodb/RELEASENOTES.md b/charts/mongodb/RELEASENOTES.md
index 12a64d5c..95139b94 100644
--- a/charts/mongodb/RELEASENOTES.md
+++ b/charts/mongodb/RELEASENOTES.md
@@ -5,6 +5,7 @@
 | 0.2.14 | 4.2.14 | Implemented startupProbe support |
 | 0.2.15 | 4.2.18 | Upgraded to MongoDB 4.2.18 |
 | 0.2.16 | 4.2.18 | Implemented support for extra secrets and advanced configuration capabilites |
+| 0.2.17 | 4.2.18 | Implemented support for extra containers |
 | 0.3.8 | 4.4.11 | Implemented startupProbe support |
 | 0.3.9 | 4.4.12 | Upgraded to MongoDB 4.4.12 |
 | 0.3.10 | 4.4.13 | Implemented support for extra secrets and advanced configuration capabilites |
diff --git a/charts/mongodb/templates/statefulset.yaml b/charts/mongodb/templates/statefulset.yaml
index dcb4cb37..32b049a8 100644
--- a/charts/mongodb/templates/statefulset.yaml
+++ b/charts/mongodb/templates/statefulset.yaml
@@ -65,6 +65,9 @@ spec:
             - mountPath: /configs
               name: configs
           command: [ "/initscripts/init.sh" ]
+      {{- with .Values.extraInitContainers }}
+      {{- toYaml . | nindent 8 }}
+      {{- end }}
       containers:
         - name: {{ .Chart.Name }}
           {{- with .Values.securityContext }}
@@ -175,6 +178,9 @@ spec:
             - name: {{ $secret.name }}
               mountPath: {{ $secret.mountPath }}
             {{- end }}
+      {{- with .Values.extraContainers }}
+      {{- toYaml . | nindent 8 }}
+      {{- end }}
       {{- with .Values.nodeSelector }}
       nodeSelector:
         {{- toYaml . | nindent 8 }}
diff --git a/charts/mongodb/values.yaml b/charts/mongodb/values.yaml
index c4c0da96..409c6852 100644
--- a/charts/mongodb/values.yaml
+++ b/charts/mongodb/values.yaml
@@ -112,6 +112,12 @@ affinity: {}
 ## Maximum number of revisions maintained in revision history
 revisionHistoryLimit:
 
+## Extra init containers
+extraInitContainers: []
+
+## Extra containers for usage as sidecars
+extraContainers: []
+
 ## Additional arguments for the container entrypoint process
 args: []
 
diff --git a/charts/postgres/Chart.yaml b/charts/postgres/Chart.yaml
index 6a986109..56513dc5 100644
--- a/charts/postgres/Chart.yaml
+++ b/charts/postgres/Chart.yaml
@@ -7,6 +7,6 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.3.6
+version: 0.2.18
 
-appVersion: "14.1"
+appVersion: "13.5"
diff --git a/charts/postgres/README.md b/charts/postgres/README.md
index ffe4ee7d..b9928067 100644
--- a/charts/postgres/README.md
+++ b/charts/postgres/README.md
@@ -1,6 +1,6 @@
 # PostgreSQL
 
-![Version: 0.3.6](https://img.shields.io/badge/Version-0.3.6-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 14.1](https://img.shields.io/badge/AppVersion-14.1-informational?style=flat-square)
+![Version: 0.2.18](https://img.shields.io/badge/Version-0.2.18-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 13.5](https://img.shields.io/badge/AppVersion-13.5-informational?style=flat-square)
 
 ## Changelog
 
@@ -62,6 +62,8 @@ helm uninstall my-release
 | image.repository | string | `"postgres"` | Image name |
 | image.tag | string | `""` | Image tag |
 | imagePullSecrets | list | `[]` | Image pull secrets |
+| extraInitContainers | list | `[]` | Extra init containers |
+| extaContainers | list | `[]` | Extra containers for usage as sidecars |
 | startupProbe | object | `see values.yaml` | Startup probe configuration |
 | livenessProbe | object | `see values.yaml` | Liveness probe configuration |
 | readinessProbe | object | `see values.yaml` | Readiness probe configuration |
diff --git a/charts/postgres/RELEASENOTES.md b/charts/postgres/RELEASENOTES.md
index 24f7994a..2114b3a9 100644
--- a/charts/postgres/RELEASENOTES.md
+++ b/charts/postgres/RELEASENOTES.md
@@ -4,6 +4,7 @@
 | :------------ | :---------- | :----------------- |
 | 0.2.16 | 13.5 | Fixes bug with wrong mounted customConfig #811 |
 | 0.2.17 | 13.5 | Implemented support for extra secrets and advanced configuration capabilites |
+| 0.2.18 | 13.5 | Implemented support for extra containers |
 | 0.3.4 | 14.1 | Fixes bug with wrong mounted customConfig #811 |
 | 0.3.5 | 14.1 | Updated readme and release notes |
 | 0.3.6 | 14.1 | Implemented support for extra secrets and advanced configuration capabilites |
diff --git a/charts/postgres/templates/statefulset.yaml b/charts/postgres/templates/statefulset.yaml
index 16ce700a..690f68e0 100644
--- a/charts/postgres/templates/statefulset.yaml
+++ b/charts/postgres/templates/statefulset.yaml
@@ -65,6 +65,9 @@ spec:
             - mountPath: /configs
               name: configs
           command: [ "/initscripts/init.sh" ]
+      {{- with .Values.extraInitContainers }}
+      {{- toYaml . | nindent 8 }}
+      {{- end }}
       containers:
         - name: {{ .Chart.Name }}
           {{- with .Values.securityContext }}
@@ -185,6 +188,9 @@ spec:
             - name: {{ $secret.name }}
               mountPath: {{ $secret.mountPath }}
             {{- end }}
+      {{- with .Values.extraContainers }}
+      {{- toYaml . | nindent 8 }}
+      {{- end }}
       {{- with .Values.nodeSelector }}
       nodeSelector:
         {{- toYaml . | nindent 8 }}
diff --git a/charts/postgres/values.yaml b/charts/postgres/values.yaml
index daa01088..26fd9887 100644
--- a/charts/postgres/values.yaml
+++ b/charts/postgres/values.yaml
@@ -111,6 +111,12 @@ readinessProbe:
   successThreshold: 1
   periodSeconds: 10
 
+## Extra init containers
+extraInitContainers: []
+
+## Extra containers for usage as sidecars
+extraContainers: []
+
 ## Additional environment variables
 env: []
 
-- 
GitLab