diff --git a/stable/mongodb/Chart.yaml b/stable/mongodb/Chart.yaml index 2766e79617..18d478b59c 100644 --- a/stable/mongodb/Chart.yaml +++ b/stable/mongodb/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: mongodb -version: 7.7.0 +version: 7.8.0 appVersion: 4.0.14 description: NoSQL document-oriented database that stores JSON-like documents with dynamic schemas, simplifying the integration of data in content-driven applications. keywords: diff --git a/stable/mongodb/README.md b/stable/mongodb/README.md index 9ff354ce89..60ae1c6a00 100644 --- a/stable/mongodb/README.md +++ b/stable/mongodb/README.md @@ -129,6 +129,7 @@ The following table lists the configurable parameters of the MongoDB chart and t | `persistence.size` | Size of data volume | `8Gi` | | `persistence.annotations` | Persistent Volume annotations | `{}` | | `persistence.existingClaim` | Name of an existing PVC to use (avoids creating one if this is given) | `nil` | +| `useStatefulSet` | Set to true to use StatefulSet instead of Deployment even when replicaSet.enalbed=false | `nil` | | `extraInitContainers` | Additional init containers as a string to be passed to the `tpl` function | `{}` | | `livenessProbe.enabled` | Enable/disable the Liveness probe | `true` | | `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `30` | diff --git a/stable/mongodb/templates/deployment-standalone.yaml b/stable/mongodb/templates/deployment-standalone.yaml index 06d9375b8e..78c9e1d704 100644 --- a/stable/mongodb/templates/deployment-standalone.yaml +++ b/stable/mongodb/templates/deployment-standalone.yaml @@ -1,6 +1,6 @@ {{- if not .Values.replicaSet.enabled }} apiVersion: apps/v1 -kind: Deployment +kind: {{ if .Values.useStatefulSet }}{{ "StatefulSet" }}{{- else }}{{ "Deployment" }}{{- end }} metadata: name: {{ template "mongodb.fullname" . }} labels: @@ -256,6 +256,7 @@ spec: name: {{ .Values.initConfigMap.name }} {{- end }} - name: data + {{- if not .Values.useStatefulSet }} {{- if .Values.persistence.enabled }} persistentVolumeClaim: claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "mongodb.fullname" . }}{{- end }} @@ -263,6 +264,7 @@ spec: {{- else }} emptyDir: {} {{- end -}} + {{- end -}} {{- if .Values.configmap }} - name: config configMap: @@ -271,4 +273,27 @@ spec: {{- if .Values.extraVolumes }} {{ toYaml .Values.extraVolumes | indent 6}} {{- end }} +{{- if .Values.useStatefulSet }} +{{- if .Values.persistence.enabled }} + volumeClaimTemplates: + - metadata: + name: data + annotations: + {{- range $key, $value := .Values.persistence.annotations }} + {{ $key }}: "{{ $value }}" + {{- end }} + spec: + accessModes: + {{- range .Values.persistence.accessModes }} + - {{ . | quote }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} + {{ include "mongodb.storageClass" . }} +{{- else }} + - name: data + emptyDir: {} +{{- end }} +{{- end }} {{- end -}} diff --git a/stable/mongodb/templates/pvc-standalone.yaml b/stable/mongodb/templates/pvc-standalone.yaml index b430671bd5..f4e114d71a 100644 --- a/stable/mongodb/templates/pvc-standalone.yaml +++ b/stable/mongodb/templates/pvc-standalone.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) (not .Values.replicaSet.enabled) }} +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) (not .Values.replicaSet.enabled) (not .Values.useStatefulSet) }} kind: PersistentVolumeClaim apiVersion: v1 metadata: diff --git a/stable/mongodb/values-production.yaml b/stable/mongodb/values-production.yaml index 4472989c1b..a7090ce362 100644 --- a/stable/mongodb/values-production.yaml +++ b/stable/mongodb/values-production.yaml @@ -147,6 +147,9 @@ service: ## # loadBalancerSourceRanges: [] +## Use StatefulSet instead of Deployment when deploying standalone +useStatefulSet: false + ## Setting up replication ## ref: https://github.com/bitnami/bitnami-docker-mongodb#setting-up-a-replication # diff --git a/stable/mongodb/values.yaml b/stable/mongodb/values.yaml index 4c68c3173a..84c411471c 100644 --- a/stable/mongodb/values.yaml +++ b/stable/mongodb/values.yaml @@ -147,6 +147,9 @@ service: # Add custom extra environment variables to all the MongoDB containers # extraEnvVars: +## Use StatefulSet instead of Deployment when deploying standalone +useStatefulSet: false + ## Setting up replication ## ref: https://github.com/bitnami/bitnami-docker-mongodb#setting-up-a-replication #