From 75f4494c85cf7e32bfefe9c0d4d83c1ccfbee8ea Mon Sep 17 00:00:00 2001 From: yelhouti Date: Wed, 2 Jun 2021 10:17:11 +0200 Subject: [PATCH] feat: mysql: add startupProb (#6507) Signed-off-by: Youssef El Houti --- bitnami/mysql/Chart.yaml | 2 +- bitnami/mysql/README.md | 4 +++ .../mysql/templates/primary/statefulset.yaml | 15 +++++++++++ .../templates/secondary/statefulset.yaml | 15 +++++++++++ bitnami/mysql/values.yaml | 26 +++++++++++++++++-- 5 files changed, 59 insertions(+), 3 deletions(-) diff --git a/bitnami/mysql/Chart.yaml b/bitnami/mysql/Chart.yaml index edea643c3..783b80b87 100644 --- a/bitnami/mysql/Chart.yaml +++ b/bitnami/mysql/Chart.yaml @@ -25,4 +25,4 @@ name: mysql sources: - https://github.com/bitnami/bitnami-docker-mysql - https://mysql.com -version: 8.5.10 +version: 8.6.0 diff --git a/bitnami/mysql/README.md b/bitnami/mysql/README.md index 217fe7b5c..00d108951 100644 --- a/bitnami/mysql/README.md +++ b/bitnami/mysql/README.md @@ -117,8 +117,10 @@ The following table lists the configurable parameters of the MySQL chart and the | `primary.containerSecurityContext.runAsUser` | User ID for the MySQL primary container | `1001` | | `primary.livenessProbe` | Liveness probe configuration for MySQL primary containers | Check `values.yaml` file | | `primary.readinessProbe` | Readiness probe configuration for MySQL primary containers | Check `values.yaml` file | +| `primary.startupProbe` | Startup probe configuration for MySQL primary containers | Check `values.yaml` file | | `primary.customLivenessProbe` | Override default liveness probe for MySQL primary containers | `nil` | | `primary.customReadinessProbe` | Override default readiness probe for MySQL primary containers | `nil` | +| `primary.customStartupProbe` | Override default startup probe for MySQL primary containers | `nil` | | `primary.resources.limits` | The resources limits for MySQL primary containers | `{}` | | `primary.resources.requests` | The requested resources for MySQL primary containers | `{}` | | `primary.extraEnvVars` | Extra environment variables to be set on MySQL primary containers | `{}` | @@ -174,8 +176,10 @@ The following table lists the configurable parameters of the MySQL chart and the | `secondary.containerSecurityContext.runAsUser` | User ID for the MySQL secondary container | `1001` | | `secondary.livenessProbe` | Liveness probe configuration for MySQL secondary containers | Check `values.yaml` file | | `secondary.readinessProbe` | Readiness probe configuration for MySQL secondary containers | Check `values.yaml` file | +| `secondary.startupProbe` | Startup probe configuration for MySQL secondary containers | Check `values.yaml` file | | `secondary.customLivenessProbe` | Override default liveness probe for MySQL secondary containers | `nil` | | `secondary.customReadinessProbe` | Override default readiness probe for MySQL secondary containers | `nil` | +| `secondary.customStartupProbe` | Override default startup probe for MySQL secondary containers | `nil` | | `secondary.resources.limits` | The resources limits for MySQL secondary containers | `{}` | | `secondary.resources.requests` | The requested resources for MySQL secondary containers | `{}` | | `secondary.extraEnvVars` | Extra environment variables to be set on MySQL secondary containers | `{}` | diff --git a/bitnami/mysql/templates/primary/statefulset.yaml b/bitnami/mysql/templates/primary/statefulset.yaml index f64d8423d..84f10eb16 100644 --- a/bitnami/mysql/templates/primary/statefulset.yaml +++ b/bitnami/mysql/templates/primary/statefulset.yaml @@ -207,6 +207,21 @@ spec: {{- else if .Values.primary.customReadinessProbe }} readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.primary.customReadinessProbe "context" $) | nindent 12 }} {{- end }} + {{- if .Values.primary.startupProbe.enabled }} + startupProbe: {{- omit .Values.primary.startupProbe "enabled" | toYaml | nindent 12 }} + exec: + command: + - /bin/bash + - -ec + - | + password_aux="${MYSQL_ROOT_PASSWORD:-}" + if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then + password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE") + fi + mysqladmin status -uroot -p"${password_aux}" + {{- else if .Values.primary.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.primary.customStartupProbe "context" $) | nindent 12 }} + {{- end }} {{- if .Values.primary.resources }} resources: {{ toYaml .Values.primary.resources | nindent 12 }} {{- end }} diff --git a/bitnami/mysql/templates/secondary/statefulset.yaml b/bitnami/mysql/templates/secondary/statefulset.yaml index 58f28ed78..3660b470a 100644 --- a/bitnami/mysql/templates/secondary/statefulset.yaml +++ b/bitnami/mysql/templates/secondary/statefulset.yaml @@ -193,6 +193,21 @@ spec: {{- else if .Values.secondary.customReadinessProbe }} readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.secondary.customReadinessProbe "context" $) | nindent 12 }} {{- end }} + {{- if .Values.secondary.startupProbe.enabled }} + startupProbe: {{- omit .Values.secondary.startupProbe "enabled" | toYaml | nindent 12 }} + exec: + command: + - /bin/bash + - -ec + - | + password_aux="${MYSQL_MASTER_ROOT_PASSWORD:-}" + if [[ -f "${MYSQL_MASTER_ROOT_PASSWORD_FILE:-}" ]]; then + password_aux=$(cat "$MYSQL_MASTER_ROOT_PASSWORD_FILE") + fi + mysqladmin status -uroot -p"${password_aux}" + {{- else if .Values.secondary.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.secondary.customStartupProbe "context" $) | nindent 12 }} + {{- end }} {{- if .Values.secondary.resources }} resources: {{ toYaml .Values.secondary.resources | nindent 12 }} {{- end }} diff --git a/bitnami/mysql/values.yaml b/bitnami/mysql/values.yaml index ce403f662..27d16294b 100644 --- a/bitnami/mysql/values.yaml +++ b/bitnami/mysql/values.yaml @@ -257,7 +257,7 @@ primary: # memory: 256Mi # cpu: 250m - ## MySQL primary container's liveness and readiness probes + ## MySQL primary container's liveness, readiness and startup probes ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes ## livenessProbe: @@ -274,6 +274,13 @@ primary: timeoutSeconds: 1 failureThreshold: 3 successThreshold: 1 + startupProbe: + enabled: true + initialDelaySeconds: 120 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 60 + successThreshold: 1 ## MySQL primary custom liveness probe ## @@ -283,6 +290,10 @@ primary: ## customReadinessProbe: {} + ## MySQL primary custom startup probe + ## + customStartupProbe: {} + ## MySQL primary additional command line flags ## Can be used to specify command line flags, for example: ## E.g. @@ -556,7 +567,7 @@ secondary: # memory: 256Mi # cpu: 250m - ## MySQL secondary container's liveness and readiness probes + ## MySQL secondary container's liveness, readiness and startup probes ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes ## livenessProbe: @@ -573,6 +584,13 @@ secondary: timeoutSeconds: 1 failureThreshold: 3 successThreshold: 1 + startupProbe: + enabled: true + initialDelaySeconds: 120 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 60 + successThreshold: 1 ## MySQL secondary custom liveness probe ## @@ -582,6 +600,10 @@ secondary: ## customReadinessProbe: {} + ## MySQL secondary custom startup probe + ## + customStartupProbe: {} + ## MySQL secondary additional command line flags ## Can be used to specify command line flags, for example: ## E.g.