[ceph-client] update checkdns script logic to handle mon_host config
This is to update checkdns script loigc not to update ceph.conf when dns is up as current logic is repalcing ceph.conf file with configmap where we have fqdn for ceph-mon endpoint which is causing parsing issues in Nautilus. Change-Id: Iae2a38fdc99654430812451c57ac2655887f942a
This commit is contained in:
parent
3b42996949
commit
ffd06369ad
@ -17,17 +17,14 @@ limitations under the License.
|
|||||||
*/}}
|
*/}}
|
||||||
|
|
||||||
: "${CEPH_CONF:="/etc/ceph/${CLUSTER}.conf"}"
|
: "${CEPH_CONF:="/etc/ceph/${CLUSTER}.conf"}"
|
||||||
ENDPOINT=$1
|
ENDPOINT="{$1}"
|
||||||
|
|
||||||
function check_mon_dns () {
|
function check_mon_dns () {
|
||||||
GREP_CMD=$(grep -rl 'ceph-mon' ${CEPH_CONF})
|
GREP_CMD=$(grep -rl 'ceph-mon' ${CEPH_CONF})
|
||||||
|
|
||||||
if [[ ${ENDPOINT} == "up" ]]; then
|
if [[ "${ENDPOINT}" == "up" ]]; then
|
||||||
# If DNS is working, we simply restore the ${CEPH_CONF} file
|
echo "If DNS is working, we are good here"
|
||||||
if [[ ${GREP_CMD} == "" ]]; then
|
elif [[ "${ENDPOINT}" != "" ]]; then
|
||||||
sh -c -e "cat ${CEPH_CONF}.template | tee ${CEPH_CONF}" > /dev/null 2>&1
|
|
||||||
fi
|
|
||||||
elif [[ ${ENDPOINT} != "" ]]; then
|
|
||||||
if [[ ${GREP_CMD} != "" ]]; then
|
if [[ ${GREP_CMD} != "" ]]; then
|
||||||
# No DNS, write CEPH MONs IPs into ${CEPH_CONF}
|
# No DNS, write CEPH MONs IPs into ${CEPH_CONF}
|
||||||
sh -c -e "cat ${CEPH_CONF}.template | sed 's/mon_host.*/mon_host = ${ENDPOINT}/g' | tee ${CEPH_CONF}" > /dev/null 2>&1
|
sh -c -e "cat ${CEPH_CONF}.template | sed 's/mon_host.*/mon_host = ${ENDPOINT}/g' | tee ${CEPH_CONF}" > /dev/null 2>&1
|
||||||
|
@ -20,15 +20,19 @@ set -xe
|
|||||||
|
|
||||||
function check_mon_dns {
|
function check_mon_dns {
|
||||||
DNS_CHECK=$(getent hosts ceph-mon | head -n1)
|
DNS_CHECK=$(getent hosts ceph-mon | head -n1)
|
||||||
PODS=$(kubectl get pods --namespace=${NAMESPACE} --selector=application=ceph --field-selector=status.phase=Running --output=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep -E 'ceph-mon|ceph-osd|ceph-mgr|ceph-mds')
|
PODS=$(kubectl get pods --namespace=${NAMESPACE} --selector=application=ceph --field-selector=status.phase=Running \
|
||||||
ENDPOINT=$(kubectl get endpoints ceph-mon -n ${NAMESPACE} -o json | awk -F'"' -v port=${MON_PORT} '/ip/{print $4":"port}' | paste -sd',')
|
--output=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep -E 'ceph-mon|ceph-osd|ceph-mgr|ceph-mds')
|
||||||
|
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 [[ ${PODS} == "" || ${ENDPOINT} == "" ]]; then
|
if [[ ${PODS} == "" || "${ENDPOINT}" == "" ]]; then
|
||||||
echo "Something went wrong, no PODS or ENDPOINTS are available!"
|
echo "Something went wrong, no PODS or ENDPOINTS are available!"
|
||||||
elif [[ ${DNS_CHECK} == "" ]]; then
|
elif [[ ${DNS_CHECK} == "" ]]; then
|
||||||
for POD in ${PODS}; do
|
for POD in ${PODS}; do
|
||||||
kubectl exec -t ${POD} --namespace=${NAMESPACE} -- \
|
kubectl exec -t ${POD} --namespace=${NAMESPACE} -- \
|
||||||
sh -c -e "/tmp/utils-checkDNS.sh ${ENDPOINT}"
|
sh -c -e "/tmp/utils-checkDNS.sh "${ENDPOINT}""
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
for POD in ${PODS}; do
|
for POD in ${PODS}; do
|
||||||
|
@ -97,6 +97,8 @@ spec:
|
|||||||
fieldPath: metadata.namespace
|
fieldPath: metadata.namespace
|
||||||
- name: MON_PORT
|
- name: MON_PORT
|
||||||
value: {{ tuple "ceph_mon" "internal" "mon" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
|
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 }}
|
||||||
- name: KUBECTL_PARAM
|
- name: KUBECTL_PARAM
|
||||||
value: {{ tuple $envAll "ceph" "checkdns" | include "helm-toolkit.snippets.kubernetes_kubectl_params" | indent 10 }}
|
value: {{ tuple $envAll "ceph" "checkdns" | include "helm-toolkit.snippets.kubernetes_kubectl_params" | indent 10 }}
|
||||||
command:
|
command:
|
||||||
|
@ -527,6 +527,8 @@ endpoints:
|
|||||||
port:
|
port:
|
||||||
mon:
|
mon:
|
||||||
default: 6789
|
default: 6789
|
||||||
|
mon_msgr2:
|
||||||
|
default: 3300
|
||||||
ceph_mgr:
|
ceph_mgr:
|
||||||
namespace: null
|
namespace: null
|
||||||
hosts:
|
hosts:
|
||||||
|
Loading…
Reference in New Issue
Block a user