From a93de3ee6831446805e3e7b6ca55e47756ef17eb Mon Sep 17 00:00:00 2001
From: Footur <tim.bultmann@systemli.org>
Date: Thu, 8 Dec 2022 17:04:36 +0100
Subject: [PATCH] [mysql] Add resource configuration for the init container
 (#1189)

* Updated ghost chart for Ghost 5.25.1

* [mysql] Add resource configuration for the init container

* Added init container resources with description

Co-authored-by: Goeran Poehner <goeran.poehner@gmail.com>
---
 charts/mysql/Chart.yaml                 | 2 +-
 charts/mysql/README.md                  | 3 ++-
 charts/mysql/RELEASENOTES.md            | 1 +
 charts/mysql/templates/statefulset.yaml | 4 ++++
 charts/mysql/values.yaml                | 9 +++++++++
 5 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/charts/mysql/Chart.yaml b/charts/mysql/Chart.yaml
index d6be3dcc..0e6ef239 100644
--- a/charts/mysql/Chart.yaml
+++ b/charts/mysql/Chart.yaml
@@ -7,6 +7,6 @@ type: application
 maintainers:
   - name: groundhog2k
 
-version: 0.1.4
+version: 0.1.5
 
 appVersion: "8.0.31-oracle"
diff --git a/charts/mysql/README.md b/charts/mysql/README.md
index 4818c0d1..c8ae2cb0 100644
--- a/charts/mysql/README.md
+++ b/charts/mysql/README.md
@@ -1,6 +1,6 @@
 # MySQL
 
-![Version: 0.1.4](https://img.shields.io/badge/Version-0.1.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 8.0.31](https://img.shields.io/badge/AppVersion-8.0.31--oracle-informational?style=flat-square)
+![Version: 0.1.5](https://img.shields.io/badge/Version-0.1.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 8.0.31](https://img.shields.io/badge/AppVersion-8.0.31--oracle-informational?style=flat-square)
 
 ## Changelog
 
@@ -68,6 +68,7 @@ helm uninstall my-release
 | customLivenessProbe | object | `{}` | Custom liveness probe (overwrites default liveness probe configuration) |
 | customReadinessProbe | object | `{}` | Custom readiness probe (overwrites default readiness probe configuration) |
 | resources | object | `{}` | Resource limits and requests |
+| initResources | object | `{}` | Resource limits and requests for the default init container |
 | nodeSelector | object | `{}` | Deployment node selector |
 | podAnnotations | object | `{}` | Additional pod annotations |
 | podSecurityContext | object | `see values.yaml` | Pod security context |
diff --git a/charts/mysql/RELEASENOTES.md b/charts/mysql/RELEASENOTES.md
index 43bed948..4db509b1 100644
--- a/charts/mysql/RELEASENOTES.md
+++ b/charts/mysql/RELEASENOTES.md
@@ -7,4 +7,5 @@
 | 0.1.2 | 8.0.30 | Implemented support for custom inline init scripts |
 | 0.1.3 | 8.0.30 | Implemented support for image.registry option |
 | 0.1.4 | 8.0.31 | Upgraded MySQL to 8.0.31 |
+| 0.1.5 | 8.0.31 | Added support for init container resources (thx @Footur) |
 | | | |
diff --git a/charts/mysql/templates/statefulset.yaml b/charts/mysql/templates/statefulset.yaml
index 2da99769..68f2fe3c 100644
--- a/charts/mysql/templates/statefulset.yaml
+++ b/charts/mysql/templates/statefulset.yaml
@@ -70,6 +70,10 @@ spec:
             - mountPath: /configs
               name: configs
           command: [ "/initscripts/init.sh" ]
+          {{- with .Values.initResources }}
+          resources:
+            {{- toYaml . | nindent 12 }}
+          {{- end }}          
       {{- with .Values.extraInitContainers }}
       {{- toYaml . | nindent 8 }}
       {{- end }}
diff --git a/charts/mysql/values.yaml b/charts/mysql/values.yaml
index 9d6a613b..05d338e0 100644
--- a/charts/mysql/values.yaml
+++ b/charts/mysql/values.yaml
@@ -70,6 +70,15 @@ resources: {}
   #   cpu: 100m
   #   memory: 128Mi
 
+# Resources of the default init container
+initResources: {}
+  # limits:
+  #   cpu: 100m
+  #   memory: 128Mi
+  # requests:
+  #   cpu: 100m
+  #   memory: 128Mi
+
 tolerations: []
 
 affinity: {}
-- 
GitLab