[stable/mongodb] Added parameter for using StatefulSet in standalone mode (#18669)

This makes it possible to configure a value to use StatefulSet instead of Deployment even if not enabling replicaSet.

Signed-off-by: Jesper Ahlberg <dargolith@dargolith.se>
This commit is contained in:
Jesper Ahlberg
2020-01-21 23:44:35 -08:00
committed by Kubernetes Prow Robot
parent 344ea022b9
commit e56f4f5ea6
6 changed files with 35 additions and 3 deletions
+1 -1
View File
@@ -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:
+1
View File
@@ -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` |
@@ -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 -}}
+1 -1
View File
@@ -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:
+3
View File
@@ -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
#
+3
View File
@@ -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
#