diff --git a/ceph-mon/Chart.yaml b/ceph-mon/Chart.yaml index bc2af46c5..1f080df90 100644 --- a/ceph-mon/Chart.yaml +++ b/ceph-mon/Chart.yaml @@ -15,6 +15,6 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Ceph Mon name: ceph-mon -version: 0.1.10 +version: 0.1.11 home: https://github.com/ceph/ceph ... diff --git a/ceph-mon/templates/bin/moncheck/_reap-zombies.py.tpl b/ceph-mon/templates/bin/moncheck/_reap-zombies.py.tpl index f33487f9c..36b00356a 100644 --- a/ceph-mon/templates/bin/moncheck/_reap-zombies.py.tpl +++ b/ceph-mon/templates/bin/moncheck/_reap-zombies.py.tpl @@ -4,7 +4,7 @@ import os import subprocess # nosec import json -MON_REGEX = r"^\d: ([0-9\.]*):\d+/\d* mon.([^ ]*)$" +MON_REGEX = r"^\d: \[((v\d+:([0-9\.]*):\d+\/\d+,*)+)] mon.([^ ]*)$" # kubctl_command = 'kubectl get pods --namespace=${NAMESPACE} -l component=mon,application=ceph -o template --template="{ {{"}}"}}range .items{{"}}"}} \\"{{"}}"}}.metadata.name{{"}}"}}\\": \\"{{"}}"}}.status.podIP{{"}}"}}\\" , {{"}}"}}end{{"}}"}} }"' if int(os.getenv('K8S_HOST_NETWORK', 0)) > 0: kubectl_command = 'kubectl get pods --namespace=${NAMESPACE} -l component=mon,application=ceph -o template --template="{ {{"{{"}}range \$i, \$v := .items{{"}}"}} {{"{{"}} if \$i{{"}}"}} , {{"{{"}} end {{"}}"}} \\"{{"{{"}}\$v.spec.nodeName{{"}}"}}\\": \\"{{"{{"}}\$v.status.podIP{{"}}"}}\\" {{"{{"}}end{{"}}"}} }"' @@ -15,16 +15,16 @@ monmap_command = "ceph --cluster=${CLUSTER} mon getmap > /tmp/monmap && monmapto def extract_mons_from_monmap(): - monmap = subprocess.check_output(monmap_command, shell=True) # nosec + monmap = subprocess.check_output(monmap_command, shell=True).decode('utf-8') # nosec mons = {} for line in monmap.split("\n"): m = re.match(MON_REGEX, line) if m is not None: - mons[m.group(2)] = m.group(1) + mons[m.group(4)] = m.group(3) return mons def extract_mons_from_kubeapi(): - kubemap = subprocess.check_output(kubectl_command, shell=True) # nosec + kubemap = subprocess.check_output(kubectl_command, shell=True).decode('utf-8') # nosec return json.loads(kubemap) current_mons = extract_mons_from_monmap() diff --git a/ceph-mon/templates/bin/moncheck/_start.sh.tpl b/ceph-mon/templates/bin/moncheck/_start.sh.tpl index 4dc4f90fd..65141d640 100644 --- a/ceph-mon/templates/bin/moncheck/_start.sh.tpl +++ b/ceph-mon/templates/bin/moncheck/_start.sh.tpl @@ -28,7 +28,7 @@ function check_mon_msgr2 { function watch_mon_health { while [ true ]; do echo "checking for zombie mons" - /tmp/moncheck-reap-zombies.py || true + python3 /tmp/moncheck-reap-zombies.py || true echo "checking for ceph-mon msgr v2" check_mon_msgr2 echo "sleep 30 sec" diff --git a/releasenotes/notes/ceph-mon.yaml b/releasenotes/notes/ceph-mon.yaml index 20f7e91ab..01e0fb0e7 100644 --- a/releasenotes/notes/ceph-mon.yaml +++ b/releasenotes/notes/ceph-mon.yaml @@ -11,4 +11,5 @@ ceph-mon: - 0.1.8 Use full image ref for docker official images - 0.1.9 Remove unnecessary parameters for ceph-mon - 0.1.10 Export crash dumps when Ceph daemons crash + - 0.1.11 Correct mon-check executing binary and logic ...