[ceph-mon] Correct Ceph Mon Check Ports
The ceph-mon-check pod only knew about the v1 port before, and didn't have the proper mon_host configuration in its ceph.conf file. This patchset adds knowledge about the v2 port also and correctly configures the ceph.conf file. Also fixes a namespace hardcoding that was found in the last ceph-mon-check fix. Change-Id: I460e43864a2d4b0683b67ae13bf6429d846173fc
This commit is contained in:
parent
25b0cdc7ec
commit
f38880b26e
@ -15,6 +15,6 @@ apiVersion: v1
|
||||
appVersion: v1.0.0
|
||||
description: OpenStack-Helm Ceph Mon
|
||||
name: ceph-mon
|
||||
version: 0.1.15
|
||||
version: 0.1.16
|
||||
home: https://github.com/ceph/ceph
|
||||
...
|
||||
|
@ -7,11 +7,14 @@ if [[ ! -e ${CEPH_CONF}.template ]]; then
|
||||
echo "ERROR- ${CEPH_CONF}.template must exist; get it from your existing mon"
|
||||
exit 1
|
||||
else
|
||||
ENDPOINT=$(kubectl get endpoints ceph-mon -n ${NAMESPACE} -o json | awk -F'"' -v port=${MON_PORT} '/ip/{print $4":"port}' | paste -sd',')
|
||||
if [[ ${ENDPOINT} == "" ]]; then
|
||||
ENDPOINT=$(kubectl get endpoints ceph-mon-discovery -n ${NAMESPACE} -o json | awk -F'"' -v port=${MON_PORT} \
|
||||
-v version=v1 -v msgr_version=v2 \
|
||||
-v msgr2_port=${MON_PORT_V2} \
|
||||
'/"ip"/{print "["version":"$4":"port"/"0","msgr_version":"$4":"msgr2_port"/"0"]"}' | paste -sd',')
|
||||
if [[ "${ENDPOINT}" == "" ]]; then
|
||||
/bin/sh -c -e "cat ${CEPH_CONF}.template | tee ${CEPH_CONF}" || true
|
||||
else
|
||||
/bin/sh -c -e "cat ${CEPH_CONF}.template | sed 's/mon_host.*/mon_host = ${ENDPOINT}/g' | tee ${CEPH_CONF}" || true
|
||||
/bin/sh -c -e "cat ${CEPH_CONF}.template | sed 's#mon_host.*#mon_host = ${ENDPOINT}#g' | tee ${CEPH_CONF}" || true
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -31,7 +34,7 @@ function get_mon_count {
|
||||
function check_mon_addrs {
|
||||
local mon_dump=$(ceph mon dump)
|
||||
local mon_hostnames=$(echo "${mon_dump}" | awk '/mon\./{print $3}' | sed 's/mon\.//g')
|
||||
local mon_endpoints=$(kubectl get endpoints ceph-mon-discovery -n ceph -o json)
|
||||
local mon_endpoints=$(kubectl get endpoints ceph-mon-discovery -n ${NAMESPACE} -o json)
|
||||
local v1_port=$(jq '.subsets[0].ports[] | select(.name == "mon") | .port' <<< ${mon_endpoints})
|
||||
local v2_port=$(jq '.subsets[0].ports[] | select(.name == "mon-msgr2") | .port' <<< ${mon_endpoints})
|
||||
|
||||
|
@ -65,10 +65,10 @@ spec:
|
||||
fieldPath: metadata.namespace
|
||||
- name: MON_PORT
|
||||
value: {{ tuple "ceph_mon" "internal" "mon" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
|
||||
- name: MON_PORT_V2
|
||||
value: {{ tuple "ceph_mon" "internal" "mon_msgr2" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
|
||||
command:
|
||||
- /tmp/moncheck-start.sh
|
||||
ports:
|
||||
- containerPort: {{ tuple "ceph_mon" "internal" "mon" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
||||
volumeMounts:
|
||||
- name: pod-tmp
|
||||
mountPath: /tmp
|
||||
|
@ -16,4 +16,5 @@ ceph-mon:
|
||||
- 0.1.13 Helm 3 - Fix Job labels
|
||||
- 0.1.14 Update htk requirements
|
||||
- 0.1.15 Prevent mon-check from removing mons when down temporarily
|
||||
- 0.1.16 Correct Ceph Mon Check Ports
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user