From 5cd3a087bf9b5cf6a466451e622db381b90e08a1 Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Fri, 5 Jan 2018 15:19:59 -0500 Subject: [PATCH] ceph-mgr: change liveness/readiness probes Instead of relying on the dashboard availability we check the ceph-mgr map Signed-off-by: Alexandre Marangone Change-Id: I78d33a4b522ed085ed85a638b3784c2d07026e39 --- ceph/templates/bin/_check_mgr.sh.tpl | 14 ++++++++++ ceph/templates/configmap-bin.yaml | 2 ++ ceph/templates/deployment-mgr.yaml | 40 +++++++++++++++++++--------- 3 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 ceph/templates/bin/_check_mgr.sh.tpl diff --git a/ceph/templates/bin/_check_mgr.sh.tpl b/ceph/templates/bin/_check_mgr.sh.tpl new file mode 100644 index 0000000000..dc9a800d10 --- /dev/null +++ b/ceph/templates/bin/_check_mgr.sh.tpl @@ -0,0 +1,14 @@ +#!/bin/bash + +set -ex +export LC_ALL=C + +source variables_entrypoint.sh + +IS_MGR_AVAIL=`ceph ${CLI_OPTS} mgr dump | python -c "import json, sys; print json.load(sys.stdin)['available']"` + +if [ "${IS_MGR_AVAIL}" = True ]; then + exit 0 +else + exit 1 +fi diff --git a/ceph/templates/configmap-bin.yaml b/ceph/templates/configmap-bin.yaml index 60f35146a7..17f1ef5c46 100644 --- a/ceph/templates/configmap-bin.yaml +++ b/ceph/templates/configmap-bin.yaml @@ -63,6 +63,8 @@ data: {{ tuple "bin/_start_rgw.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} start_mgr.sh: |+ {{ tuple "bin/_start_mgr.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} + check_mgr.sh: |+ +{{ tuple "bin/_check_mgr.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} init_rgw_ks.sh: |+ {{ tuple "bin/_init_rgw_ks.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} watch_mon_health.sh: |+ diff --git a/ceph/templates/deployment-mgr.yaml b/ceph/templates/deployment-mgr.yaml index 857e41fcb4..46018ad514 100644 --- a/ceph/templates/deployment-mgr.yaml +++ b/ceph/templates/deployment-mgr.yaml @@ -73,23 +73,35 @@ spec: imagePullPolicy: {{ .Values.images.pull_policy }} {{ tuple $envAll $envAll.Values.pod.resources.mgr | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} env: - - name: MGR_PORT - value: "{{ .Values.network.port.mgr }}" + {{- if .Values.ceph_mgr_enabled_modules }} + - name: ENABLED_MODULES + value: |- + {{- range $value := .Values.ceph_mgr_enabled_modules }} + {{ $value }} + {{- end }} + {{- end }} + {{- if .Values.ceph_mgr_modules_config }} + {{- range $module,$params := .Values.ceph_mgr_modules_config }} + {{- range $key, $value := $params }} + - name: {{ $module }}_{{ $key }} + value: {{ $value | quote }} + {{- end }} + {{- end }} + {{- end }} command: - /start_mgr.sh - ports: - - containerPort: {{ .Values.network.port.mgr }} livenessProbe: - httpGet: - path: / - port: {{ .Values.network.port.mgr }} - initialDelaySeconds: 120 + exec: + command: + - bash + - /check_mgr.sh + initialDelaySeconds: 30 timeoutSeconds: 5 readinessProbe: - httpGet: - path: / - port: {{ .Values.network.port.mgr }} - timeoutSeconds: 5 + exec: + command: + - bash + - /check_mgr.sh volumeMounts: - name: pod-etc-ceph mountPath: /etc/ceph @@ -101,6 +113,10 @@ spec: mountPath: /start_mgr.sh subPath: start_mgr.sh readOnly: true + - name: ceph-bin + mountPath: /check_mgr.sh + subPath: check_mgr.sh + readOnly: true - name: ceph-bin mountPath: /variables_entrypoint.sh subPath: variables_entrypoint.sh