Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

[stable/mongodb-replicaset] liveness/startupProbe tuning #23046

Merged
merged 3 commits into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stable/mongodb-replicaset/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: mongodb-replicaset
home: https://github.com/mongodb/mongo
version: 3.16.2
version: 3.17.0
appVersion: 3.6
description: NoSQL document-oriented database that stores JSON-like documents with
dynamic schemas, simplifying the integration of data in content-driven applications.
Expand Down
5 changes: 5 additions & 0 deletions stable/mongodb-replicaset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ The following table lists the configurable parameters of the mongodb chart and t
| `readinessProbe.periodSeconds` | Readiness probe period seconds | `10` |
| `readinessProbe.successThreshold` | Readiness probe success threshold | `1` |
| `readinessProbe.timeoutSeconds` | Readiness probe timeout seconds | `1` |
| `startupProbe.failureThreshold` | Startup probe failure threshold | `60` |
| `startupProbe.initialDelaySeconds` | Startup probe initial delay seconds | `5` |
| `startupProbe.periodSeconds` | Startup probe period seconds | `10` |
| `startupProbe.successThreshold` | Startup probe success threshold | `2` |
| `startupProbe.timeoutSeconds` | Startup probe timeout seconds | `5` |
| `extraContainers` | Additional containers to add to the StatefulSet | `[]` |
| `extraVars` | Set environment variables for the main container | `{}` |
| `extraLabels` | Additional labels to add to resources | `{}` |
Expand Down
38 changes: 36 additions & 2 deletions stable/mongodb-replicaset/templates/mongodb-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,24 @@ spec:
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
{{- if semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion -}}
startupProbe:
exec:
command:
- mongo
{{- if .Values.tls.enabled }}
- --ssl
- --sslCAFile=/data/configdb/tls.crt
- --sslPEMKeyFile=/work-dir/mongo.pem
{{- end }}
- --eval
- "db.adminCommand('ping')"
initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }}
failureThreshold: {{ .Values.startupProbe.failureThreshold }}
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
successThreshold: {{ .Values.startupProbe.successThreshold }}
{{- end }}
readinessProbe:
exec:
command:
Expand Down Expand Up @@ -296,8 +314,24 @@ spec:
/bin/mongodb_exporter
--mongodb.uri {{ template "mongodb-replicaset.connection-string" . }}
--test
initialDelaySeconds: 30
periodSeconds: 10
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
{{- if semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion -}}
startupProbe:
exec:
command:
- sh
- -c
- >-
/bin/mongodb_exporter
--mongodb.uri {{ template "mongodb-replicaset.connection-string" . }}
--test
initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }}
failureThreshold: {{ .Values.startupProbe.failureThreshold }}
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
successThreshold: {{ .Values.startupProbe.successThreshold }}
{{- end }}
{{ end }}
{{- if .Values.extraContainers }}
{{- tpl (toYaml .Values.extraContainers) . | nindent 8 }}
Expand Down
9 changes: 9 additions & 0 deletions stable/mongodb-replicaset/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,15 @@ livenessProbe:
periodSeconds: 10
successThreshold: 1

# Startup probe, will only be added since Kubernetes v1.16 or higher
# When you have a lot of collections/indices, MongoDB need some time to start
startupProbe:
initialDelaySeconds: 5
wonko marked this conversation as resolved.
Show resolved Hide resolved
timeoutSeconds: 5
failureThreshold: 60
periodSeconds: 10
successThreshold: 2

# Enables/disables the headless client service
clientService:
enabled: true