diff --git a/charts/mariadb/Chart.yaml b/charts/mariadb/Chart.yaml index c25bba0cc5c1404c1eec2d57bd3d12166a1dcb18..ffe007b4b4c958a30872c838dab69a183ee0a098 100644 --- a/charts/mariadb/Chart.yaml +++ b/charts/mariadb/Chart.yaml @@ -7,6 +7,6 @@ type: application maintainers: - name: groundhog2k -version: "0.8.0" +version: "0.8.1" appVersion: "10.11.2" diff --git a/charts/mariadb/README.md b/charts/mariadb/README.md index bea9361e5e6422bc77f7cc14650082ce20d0f5e8..be98aec384c3fb8834d70a8eef3088d5443b87ad 100644 --- a/charts/mariadb/README.md +++ b/charts/mariadb/README.md @@ -1,6 +1,6 @@ # MariaDB -   +   ## Changelog @@ -103,11 +103,13 @@ helm uninstall my-release | storage.volumeName | string | `"db-volume"` | Internal volume name and prefix of a created PVC | | storage.requestedSize | string | `nil` | Size for new PVC, when no existing PVC is used | | storage.className | string | `nil` | Storage class name | +| storage.keepPvc | bool | `false` | Keep a created Persistent volume claim when uninstalling the helm chart (only for option `useDeployment: true`) | ## MariaDB parameters | Key | Type | Default | Description | |-----|------|---------|-------------| +| useDeployment | bool | `false` | Use Kubernetes Deployment instead of StatefulSet | | userDatabase | object | `{}` | Optional MariaDB user database | | userDatabase.name | string | `""` | Name of the user database | | userDatabase.user | string | `""` | User name with full access to user database| diff --git a/charts/mariadb/RELEASENOTES.md b/charts/mariadb/RELEASENOTES.md index 2965ed1d319d37931173e02ecca1dcd0f4b32328..b1f9ed4f250aef8f45de6d987a0a8b103ad7f5c9 100644 --- a/charts/mariadb/RELEASENOTES.md +++ b/charts/mariadb/RELEASENOTES.md @@ -47,4 +47,5 @@ | 0.7.1 | 10.10.2 | Added support for init container resources (thx @Footur) | | 0.7.2 | 10.10.3 | Upgraded MariaDB to 10.10.3 | | 0.8.0 | 10.11.2 | Upgraded MariaDB to 10.11.2 | +| 0.8.1 | 10.11.2 | Implemented alternative distribution with `Deployment` template (thx @tim-hanssen) | | | | | diff --git a/charts/mariadb/templates/pvc.yaml b/charts/mariadb/templates/pvc.yaml new file mode 100644 index 0000000000000000000000000000000000000000..963bd26884f4eecb4d9c9983b8a4e5754609c146 --- /dev/null +++ b/charts/mariadb/templates/pvc.yaml @@ -0,0 +1,27 @@ +{{- if .Values.useDeployment }} +{{- $createPvc := and (empty .Values.storage.persistentVolumeClaimName) (.Values.storage.requestedSize) }} +{{- if $createPvc }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "mariadb.fullname" . }} + labels: + {{- include "mariadb.labels" . | nindent 4 }} + {{- if .Values.storage.keepPvc }} + annotations: + "helm.sh/resource-policy": keep + {{- end }} +spec: + {{- with .Values.storage }} + accessModes: + {{- toYaml .accessModes | nindent 4 }} + volumeMode: Filesystem + resources: + requests: + storage: {{ .requestedSize }} + {{- if .className }} + storageClassName: {{ .className }} + {{- end }} + {{- end }} +{{- end }} +{{- end }} diff --git a/charts/mariadb/templates/statefulset.yaml b/charts/mariadb/templates/statefulset.yaml index a9c615ab69089d3e284a6beda694bf1007d90dca..33e9762e555133c31685701f883f7c87bc8599f1 100644 --- a/charts/mariadb/templates/statefulset.yaml +++ b/charts/mariadb/templates/statefulset.yaml @@ -1,7 +1,13 @@ +{{- $usedeployment := .Values.useDeployment }} +{{- $fullname := include "mariadb.fullname" . }} apiVersion: apps/v1 +{{- if $usedeployment }} +kind: Deployment +{{- else }} kind: StatefulSet +{{- end }} metadata: - name: {{ include "mariadb.fullname" . }} + name: {{ $fullname }} labels: {{- include "mariadb.labels" . | nindent 4 }} spec: @@ -9,10 +15,12 @@ spec: {{- if .Values.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} {{- end }} - serviceName: {{ include "mariadb.fullname" . }} + {{- if not $usedeployment }} + serviceName: {{ $fullname }} podManagementPolicy: {{ .Values.podManagementPolicy }} updateStrategy: type: {{ .Values.updateStrategyType }} + {{- end }} selector: matchLabels: {{- include "mariadb.selectorLabels" . | nindent 6 }} @@ -189,7 +197,7 @@ spec: envFrom: {{- if include "mariadb.createSecureConfig" . }} - secretRef: - name: {{ include "mariadb.fullname" . }} + name: {{ $fullname }} {{- end }} {{- range .Values.extraEnvSecrets }} - secretRef: @@ -219,12 +227,12 @@ spec: emptyDir: {} - name: initscripts configMap: - name: {{ include "mariadb.fullname" . }}-scripts + name: {{ $fullname }}-scripts defaultMode: 0555 {{- if .Values.customScripts }} - name: customscripts-volume configMap: - name: {{ include "mariadb.fullname" . }}-customscripts + name: {{ $fullname }}-customscripts defaultMode: 0555 {{- end }} {{- if .Values.extraSecretConfigs }} @@ -235,7 +243,7 @@ spec: {{- if .Values.customConfig }} - name: customconfig-volume configMap: - name: {{ include "mariadb.fullname" . }} + name: {{ $fullname }} {{- end }} {{- if .Values.extraScripts }} - name: extrascripts-volume @@ -249,7 +257,6 @@ spec: secretName: {{ $secret.name }} defaultMode: 0440 {{- end }} -{{- $fullname := include "mariadb.fullname" . }} {{- with .Values.storage }} {{- $createPvc := and (empty .persistentVolumeClaimName) .requestedSize }} {{- if not $createPvc }} @@ -261,6 +268,11 @@ spec: emptyDir: {} {{- end }} {{- else }} + {{- if $usedeployment }} + - name: {{ .volumeName }} + persistentVolumeClaim: + claimName: {{ $fullname }} + {{- else }} volumeClaimTemplates: - metadata: name: {{ .volumeName }} @@ -276,4 +288,5 @@ spec: requests: storage: {{ .requestedSize }} {{- end }} + {{- end }} {{- end }} diff --git a/charts/mariadb/values.yaml b/charts/mariadb/values.yaml index 2a97736b00877f874e0f5e4857f0602784f8aea2..a8444893fbed3226e963f47e26fc28e66b99b82f 100644 --- a/charts/mariadb/values.yaml +++ b/charts/mariadb/values.yaml @@ -131,6 +131,9 @@ extraContainers: [] ## Additional environment variables env: [] +## Use Kubernetes Deployment instead of StatefulSet +useDeployment: false + ## Database configuration settings: ## Arguments for the container entrypoint process @@ -207,3 +210,6 @@ storage: ## Default access mode (ReadWriteOnce) accessModes: - ReadWriteOnce + + ## Keep a created Persistent volume claim when uninstalling the helm chart (only for option useDeployment: true) + keepPvc: false