From 62b12e3af517087655bec10d91ea5c8cdb52d62e Mon Sep 17 00:00:00 2001 From: jlego229-kim Date: Fri, 12 Jul 2019 14:13:15 +0900 Subject: [PATCH] Fix an error while getting Pod's nodeName when setting up VMs with vbmc Currently, in the script which sets up VMs with vmbc instead of BM for ironic practice, There is an IF command checking if OVS_VSWITCHD pod is located in master node or not. To get the info about Pod's nodeName, command below has been used. $ kubectl --namespace openstack get pod "${OVS_VSWITCHD_POD}" -o wide --no-headers | awk '{ print $NF }' But this command sometimes cannot parse Pod's nodeName correctly becuase new headers such as "NOMINATED NODE" and "READINESS GATE" are printed in the end "-o wide" option. (in some version of k8s) To avoid this problem and give more readability, I suggest changing commands to use "-o json" option. Change-Id: Ib81ae505ac8d04dae9af6326880e1fa17664ac0b --- tools/deployment/baremetal/005-setup-nodes.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/deployment/baremetal/005-setup-nodes.sh b/tools/deployment/baremetal/005-setup-nodes.sh index 60d3e4f210..1751566129 100755 --- a/tools/deployment/baremetal/005-setup-nodes.sh +++ b/tools/deployment/baremetal/005-setup-nodes.sh @@ -94,7 +94,7 @@ OVS_VSWITCHD_PODS=$(kubectl get --namespace openstack pods \ for OVS_VSWITCHD_POD in ${OVS_VSWITCHD_PODS}; do kubectl exec --namespace openstack "${OVS_VSWITCHD_POD}" \ -- ovs-vsctl add-br "${OSH_IRONIC_PXE_DEV}" - if [ "x$(kubectl --namespace openstack get pod "${OVS_VSWITCHD_POD}" -o wide --no-headers | awk '{ print $NF }')" == "x$(hostname -f)" ] ; then + if [ "x$(kubectl --namespace openstack get pod "${OVS_VSWITCHD_POD}" -o json | jq -r '.spec.nodeName')" == "x$(hostname -f)" ] ; then COUNTER=0 for NODE_IP in ${NODE_IPS}; do if ! [ "x${MASTER_IP}" == "x${NODE_IP}" ]; then