From 079cd8ddc23db393a34c69c14eec6a1270b44f3e Mon Sep 17 00:00:00 2001 From: Shihang Zhang Date: Tue, 22 Sep 2020 10:56:05 -0700 Subject: [PATCH] fix upgrade test --- cluster/gce/upgrade.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cluster/gce/upgrade.sh b/cluster/gce/upgrade.sh index e7a75b6b0d6..01555e65908 100755 --- a/cluster/gce/upgrade.sh +++ b/cluster/gce/upgrade.sh @@ -464,14 +464,20 @@ function update-coredns-config() { cleanup() { rm -rf "${download_dir}" } - trap cleanup EXIT + trap cleanup RETURN # Get the new installed CoreDNS version - echo "Waiting for CoreDNS to update" - until [[ $("${KUBE_ROOT}"/cluster/kubectl.sh -n kube-system get deployment coredns -o=jsonpath='{$.metadata.resourceVersion}') -ne ${COREDNS_DEPLOY_RESOURCE_VERSION} ]]; do + echo "== Waiting for CoreDNS to update ==" + local -r endtime=$(date -ud "3 minute" +%s) + until [[ $("${KUBE_ROOT}"/cluster/kubectl.sh -n kube-system get deployment coredns -o=jsonpath='{$.metadata.resourceVersion}') -ne ${COREDNS_DEPLOY_RESOURCE_VERSION} ]] || [[ $(date -u +%s) -gt $endtime ]]; do sleep 1 done - echo "Fetching the latest installed CoreDNS version" + + if [[ $("${KUBE_ROOT}"/cluster/kubectl.sh -n kube-system get deployment coredns -o=jsonpath='{$.metadata.resourceVersion}') -ne ${COREDNS_DEPLOY_RESOURCE_VERSION} ]]; then + echo "== CoreDNS ResourceVersion changed ==" + fi + + echo "== Fetching the latest installed CoreDNS version ==" NEW_COREDNS_VERSION=$("${KUBE_ROOT}"/cluster/kubectl.sh -n kube-system get deployment coredns -o=jsonpath='{$.spec.template.spec.containers[:1].image}' | cut -d ":" -f 2) case "$(uname -m)" in