Skip to content

Commit

Permalink
[bitnami/mysql] fix!: 🐛 ✨ 💥 Set correct serviceName and add Password …
Browse files Browse the repository at this point in the history
…Update Job (bitnami#30351)

* [bitnami/mysql] fix!: 🐛 ✨ 💥 Set correct serviceName and add Password Update Job

Signed-off-by: Javier J. Salmerón García <[email protected]>

* docs: 📝 Update Parameter Table

Signed-off-by: Javier J. Salmerón García <[email protected]>

* docs: 🚨 Use proper link

Signed-off-by: Javier J. Salmerón García <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <[email protected]>

* fix: 🐛 Set correct references

Signed-off-by: Javier J. Salmerón García <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <[email protected]>

---------

Signed-off-by: Javier J. Salmerón García <[email protected]>
Signed-off-by: Bitnami Containers <[email protected]>
Co-authored-by: Bitnami Containers <[email protected]>
  • Loading branch information
2 people authored and sajad-sadra committed Nov 20, 2024
1 parent 5e70e5f commit b85bfa6
Show file tree
Hide file tree
Showing 29 changed files with 649 additions and 19 deletions.
15 changes: 12 additions & 3 deletions bitnami/mysql/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
# Changelog

## 11.1.20 (2024-10-18)
## 12.0.0 (2024-11-12)

* [bitnami/mysql] Drop unused `getValueFromSecret` local helper ([#29962](https://github.com/bitnami/charts/pull/29962))
* [bitnami/mysql] fix!: :bug: :sparkles: :boom: Set correct serviceName and add Password Update Job ([#30351](https://github.com/bitnami/charts/pull/30351))

## <small>11.1.20 (2024-11-04)</small>

* [bitnami/*] Remove wrong comment about imagePullPolicy (#30107) ([a51f9e4](https://github.com/bitnami/charts/commit/a51f9e4bb0fbf77199512d35de7ac8abe055d026)), closes [#30107](https://github.com/bitnami/charts/issues/30107)
* [bitnami/mysql] Drop unused `getValueFromSecret` local helper (#29962) ([1879393](https://github.com/bitnami/charts/commit/18793934bc234cab61b24c02497591f03e4b0beb)), closes [#29962](https://github.com/bitnami/charts/issues/29962)
* Update documentation links to techdocs.broadcom.com (#29931) ([f0d9ad7](https://github.com/bitnami/charts/commit/f0d9ad78f39f633d275fc576d32eae78ded4d0b8)), closes [#29931](https://github.com/bitnami/charts/issues/29931)

## <small>11.1.19 (2024-10-16)</small>

* [bitnami/mysql] Release 11.1.18 (#29887) ([57306e6](https://github.com/bitnami/charts/commit/57306e6212ae61b7140d67c41effb9e5fffb66d7)), closes [#29887](https://github.com/bitnami/charts/issues/29887)
* [bitnami/mysql] Release 11.1.19 (#29929) ([1381f66](https://github.com/bitnami/charts/commit/1381f665f7a58bd3c2abae738b05c3be1da0062b)), closes [#29929](https://github.com/bitnami/charts/issues/29929)

## <small>11.1.18 (2024-10-14)</small>

* [bitnami/mysql] Release 11.1.18 (#29887) ([57306e6](https://github.com/bitnami/charts/commit/57306e6212ae61b7140d67c41effb9e5fffb66d7)), closes [#29887](https://github.com/bitnami/charts/issues/29887)

## <small>11.1.17 (2024-09-17)</small>

* [bitnami/mysql] test: :white_check_mark: Improve reliability of ginkgo tests (#29470) ([a233966](https://github.com/bitnami/charts/commit/a233966beb176cddf29dfe71f19228873bd99bac)), closes [#29470](https://github.com/bitnami/charts/issues/29470)
Expand Down
6 changes: 3 additions & 3 deletions bitnami/mysql/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.26.0
digest: sha256:5ff7837915aef0067bd32271ee2b10c990774c16c4b6fe0a7c5eb6e53530ce08
generated: "2024-10-16T09:34:24.386936413Z"
version: 2.27.0
digest: sha256:b711ab5874abf868a0c64353a790f17771758cee6f802acb9819be004c8460af
generated: "2024-11-08T12:54:59.05922644+01:00"
2 changes: 1 addition & 1 deletion bitnami/mysql/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ maintainers:
name: mysql
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/mysql
version: 11.1.20
version: 12.0.0
112 changes: 112 additions & 0 deletions bitnami/mysql/README.md

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions bitnami/mysql/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,44 @@ Return true if a secret object should be created for MySQL
{{- end -}}
{{- end -}}

{{/*
Return true if a secret object should be created for MySQL
*/}}
{{- define "mysql.createPreviousSecret" -}}
{{- if and .Values.passwordUpdateJob.previousPasswords.rootPassword (not .Values.passwordUpdateJob.previousPasswords.existingSecret) }}
{{- true -}}
{{- end -}}
{{- end -}}

{{/*
Return the secret with previous MySQL credentials
*/}}
{{- define "mysql.update-job.previousSecretName" -}}
{{- if .Values.passwordUpdateJob.previousPasswords.existingSecret -}}
{{- /* The secret with the new password is managed externally */ -}}
{{- tpl .Values.passwordUpdateJob.previousPasswords.existingSecret $ -}}
{{- else if .Values.passwordUpdateJob.previousPasswords.rootPassword -}}
{{- /* The secret with the new password is managed externally */ -}}
{{- printf "%s-previous-secret" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- /* The secret with the new password is managed by the helm chart. We use the current secret name as it has the old password */ -}}
{{- include "common.names.fullname" . -}}
{{- end -}}
{{- end -}}

{{/*
Return the secret with new MySQL credentials
*/}}
{{- define "mysql.update-job.newSecretName" -}}
{{- if and (not .Values.passwordUpdateJob.previousPasswords.existingSecret) (not .Values.passwordUpdateJob.previousPasswords.rootPassword) -}}
{{- /* The secret with the new password is managed by the helm chart. We create a new secret as the current one has the old password */ -}}
{{- printf "%s-new-secret" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- /* The secret with the new password is managed externally */ -}}
{{- include "mysql.secretName" . -}}
{{- end -}}
{{- end -}}

{{/* Check if there are rolling tags in the images */}}
{{- define "mysql.checkRollingTags" -}}
{{- include "common.warnings.rollingTag" .Values.image }}
Expand Down
1 change: 1 addition & 0 deletions bitnami/mysql/templates/metrics-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ printf "%s-metrics" (include "common.names.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: metrics
{{- if or .Values.metrics.service.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.metrics.service.annotations .Values.commonAnnotations ) "context" . ) }}
Expand Down
1 change: 1 addition & 0 deletions bitnami/mysql/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ template "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions bitnami/mysql/templates/primary/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ include "mysql.primary.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: primary
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ printf "%s-init-scripts" (include "mysql.primary.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: primary
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
Expand Down
2 changes: 2 additions & 0 deletions bitnami/mysql/templates/primary/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ include "mysql.primary.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: primary
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
Expand All @@ -24,5 +25,6 @@ spec:
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.podLabels .Values.commonLabels ) "context" . ) }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: primary
{{- end }}
1 change: 1 addition & 0 deletions bitnami/mysql/templates/primary/startdb-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ printf "%s-start-scripts" (include "mysql.primary.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: mysql
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
Expand Down
8 changes: 7 additions & 1 deletion bitnami/mysql/templates/primary/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
name: {{ include "mysql.primary.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: primary
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
Expand All @@ -19,8 +20,9 @@ spec:
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.podLabels .Values.commonLabels ) "context" . ) }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: primary
serviceName: {{ include "mysql.primary.fullname" . }}
serviceName: {{ printf "%s-headless" (include "mysql.primary.fullname" .) | trunc 63 | trimSuffix "-" }}
{{- if .Values.primary.updateStrategy }}
updateStrategy: {{- toYaml .Values.primary.updateStrategy | nindent 4 }}
{{- end }}
Expand All @@ -30,10 +32,14 @@ spec:
{{- if (include "mysql.primary.createConfigmap" .) }}
checksum/configuration: {{ include (print $.Template.BasePath "/primary/configmap.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.passwordUpdateJob.enabled }}
charts.bitnami.com/password-last-update: {{ now | date "20060102150405" | quote }}
{{- end }}
{{- if .Values.primary.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.primary.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: primary
spec:
{{- if .Values.primary.extraPodSpec }}
Expand Down
3 changes: 2 additions & 1 deletion bitnami/mysql/templates/primary/svc-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ SPDX-License-Identifier: APACHE-2.0
apiVersion: v1
kind: Service
metadata:
name: {{ include "mysql.primary.fullname" . }}-headless
name: {{ printf "%s-headless" (include "mysql.primary.fullname" .) | trunc 63 | trimSuffix "-" }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: primary
{{- if or .Values.primary.service.headless.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.service.headless.annotations .Values.commonAnnotations ) "context" . ) }}
Expand Down
2 changes: 2 additions & 0 deletions bitnami/mysql/templates/primary/svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
name: {{ include "mysql.primary.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: primary
{{- if or .Values.primary.service.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.service.annotations .Values.commonAnnotations ) "context" . ) }}
Expand Down Expand Up @@ -60,4 +61,5 @@ spec:
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.primary.podLabels .Values.commonLabels ) "context" . ) }}
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: primary
1 change: 1 addition & 0 deletions bitnami/mysql/templates/prometheusrule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.prometheusRule.namespace }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: metrics
{{- if .Values.metrics.prometheusRule.additionalLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.prometheusRule.additionalLabels "context" $ ) | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions bitnami/mysql/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions bitnami/mysql/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions bitnami/mysql/templates/secondary/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ include "mysql.secondary.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: secondary
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions bitnami/mysql/templates/secondary/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ include "mysql.secondary.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: secondary
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
Expand Down
8 changes: 7 additions & 1 deletion bitnami/mysql/templates/secondary/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ include "mysql.secondary.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: secondary
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
Expand All @@ -20,8 +21,9 @@ spec:
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.secondary.podLabels .Values.commonLabels ) "context" . ) }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: secondary
serviceName: {{ include "mysql.secondary.fullname" . }}
serviceName: {{ printf "%s-headless" (include "mysql.secondary.fullname" .) | trunc 63 | trimSuffix "-" }}
{{- if .Values.secondary.updateStrategy }}
updateStrategy: {{- toYaml .Values.secondary.updateStrategy | nindent 4 }}
{{- end }}
Expand All @@ -31,10 +33,14 @@ spec:
{{- if (include "mysql.secondary.createConfigmap" .) }}
checksum/configuration: {{ include (print $.Template.BasePath "/secondary/configmap.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.passwordUpdateJob.enabled }}
charts.bitnami.com/password-last-update: {{ now | date "20060102150405" | quote }}
{{- end }}
{{- if .Values.secondary.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.secondary.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: secondary
spec:
{{- if .Values.secondary.extraPodSpec }}
Expand Down
4 changes: 3 additions & 1 deletion bitnami/mysql/templates/secondary/svc-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ SPDX-License-Identifier: APACHE-2.0
apiVersion: v1
kind: Service
metadata:
name: {{ include "mysql.secondary.fullname" . }}-headless
name: {{ printf "%s-headless" (include "mysql.secondary.fullname" .) | trunc 63 | trimSuffix "-" }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: secondary
{{- if or .Values.secondary.service.headless.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.secondary.service.headless.annotations .Values.commonAnnotations ) "context" . ) }}
Expand All @@ -30,5 +31,6 @@ spec:
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.secondary.podLabels .Values.commonLabels ) "context" . ) }}
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: secondary
{{- end }}
1 change: 1 addition & 0 deletions bitnami/mysql/templates/secondary/svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ include "mysql.secondary.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: mysql
app.kubernetes.io/component: secondary
{{- if or .Values.secondary.service.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.secondary.service.annotations .Values.commonAnnotations ) "context" . ) }}
Expand Down
Loading

0 comments on commit b85bfa6

Please sign in to comment.