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

* MongoDB liveness/startupProbe tuning

Signed-off-by: Bernard Grymonpon <bernard.grymonpon@oqton.com>

* 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 <bernard.grymonpon@oqton.com>
This commit is contained in:
Bernard Grymonpon
2020-07-14 07:17:21 -07:00
committed by GitHub
parent b78b82d388
commit 79190dbf2e
4 changed files with 51 additions and 3 deletions
+1 -1
View File
@@ -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.
+5
View File
@@ -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 | `{}` |
@@ -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:
@@ -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 }}
+9
View File
@@ -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