Skip to content

Commit

Permalink
[stable/mongodb-replicaset] liveness/startupProbe tuning (helm#23046)
Browse files Browse the repository at this point in the history
* MongoDB liveness/startupProbe tuning

Signed-off-by: Bernard Grymonpon <[email protected]>

* Changes after review

- 1.18 as target k8s api version
- aligned the values and readme
- changed probe for the metrics server

Signed-off-by: Bernard Grymonpon <[email protected]>
Signed-off-by: Adrien Loiseau <[email protected]>
  • Loading branch information
wonko authored and li-adrienloiseau committed Jul 29, 2020
1 parent 2c56c37 commit 0801c47
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 3 deletions.
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
timeoutSeconds: 5
failureThreshold: 60
periodSeconds: 10
successThreshold: 2

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

0 comments on commit 0801c47

Please sign in to comment.