From 9120a60724bbe494b9dc80b4eff9311e17c8aa99 Mon Sep 17 00:00:00 2001 From: gmarek Date: Thu, 31 Mar 2016 09:13:42 -0700 Subject: [PATCH] Kubemark uses kubectl from the repo --- test/kubemark/common.sh | 2 ++ test/kubemark/start-kubemark.sh | 17 ++++++----------- test/kubemark/stop-kubemark.sh | 4 ++-- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/test/kubemark/common.sh b/test/kubemark/common.sh index 2fa6200e94f..52e9c8056e6 100644 --- a/test/kubemark/common.sh +++ b/test/kubemark/common.sh @@ -27,6 +27,8 @@ EVENT_STORE_NAME="${INSTANCE_PREFIX}-event-store" RETRIES=3 +export KUBECTL="${KUBE_ROOT}/cluster/kubectl.sh" + # Runs gcloud compute command with the given parameters. Up to $RETRIES will be made # to execute the command. # arguments: diff --git a/test/kubemark/start-kubemark.sh b/test/kubemark/start-kubemark.sh index d2248f70e47..1391627d2c1 100755 --- a/test/kubemark/start-kubemark.sh +++ b/test/kubemark/start-kubemark.sh @@ -18,11 +18,6 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. -if ! command -v kubectl >/dev/null 2>&1; then - echo "Please install kubectl before running this script" - exit 1 -fi - source "${KUBE_ROOT}/test/kubemark/common.sh" RUN_FROM_DISTRO=${RUN_FROM_DISTRO:-false} @@ -209,15 +204,15 @@ EOF sed "s/##numreplicas##/${NUM_NODES:-10}/g" "${KUBE_ROOT}"/test/kubemark/hollow-node_template.json > "${KUBE_ROOT}"/test/kubemark/hollow-node.json sed -i'' -e "s/##project##/${PROJECT}/g" "${KUBE_ROOT}"/test/kubemark/hollow-node.json -kubectl create -f "${KUBE_ROOT}"/test/kubemark/kubemark-ns.json -kubectl create -f "${KUBECONFIG_SECRET}" --namespace="kubemark" -kubectl create -f "${KUBE_ROOT}"/test/kubemark/hollow-node.json --namespace="kubemark" +"${KUBECTL}" create -f "${KUBE_ROOT}"/test/kubemark/kubemark-ns.json +"${KUBECTL}" create -f "${KUBECONFIG_SECRET}" --namespace="kubemark" +"${KUBECTL}" create -f "${KUBE_ROOT}"/test/kubemark/hollow-node.json --namespace="kubemark" rm "${KUBECONFIG_SECRET}" echo "Waiting for all HollowNodes to become Running..." start=$(date +%s) -nodes=$(kubectl --kubeconfig="${KUBE_ROOT}"/test/kubemark/kubeconfig.loc get node) || true +nodes=$("${KUBECTL}" --kubeconfig="${KUBE_ROOT}"/test/kubemark/kubeconfig.loc get node) || true ready=$(($(echo "${nodes}" | grep -v "NotReady" | wc -l) - 1)) until [[ "${ready}" -ge "${NUM_NODES}" ]]; do @@ -229,14 +224,14 @@ until [[ "${ready}" -ge "${NUM_NODES}" ]]; do echo "" echo "Timeout waiting for all HollowNodes to become Running" # Try listing nodes again - if it fails it means that API server is not responding - if kubectl --kubeconfig="${KUBE_ROOT}"/test/kubemark/kubeconfig.loc get node &> /dev/null; then + if "${KUBECTL}" --kubeconfig="${KUBE_ROOT}"/test/kubemark/kubeconfig.loc get node &> /dev/null; then echo "Found only ${ready} ready Nodes while waiting for ${NUM_NODES}." exit 1 fi echo "Got error while trying to list Nodes. Probably API server is down." exit 1 fi - nodes=$(kubectl --kubeconfig="${KUBE_ROOT}"/test/kubemark/kubeconfig.loc get node) || true + nodes=$("${KUBECTL}" --kubeconfig="${KUBE_ROOT}"/test/kubemark/kubeconfig.loc get node) || true ready=$(($(echo "${nodes}" | grep -v "NotReady" | wc -l) - 1)) done diff --git a/test/kubemark/stop-kubemark.sh b/test/kubemark/stop-kubemark.sh index 2f07e2e79f5..da3e6973d74 100755 --- a/test/kubemark/stop-kubemark.sh +++ b/test/kubemark/stop-kubemark.sh @@ -19,8 +19,8 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. source "${KUBE_ROOT}/test/kubemark/common.sh" -kubectl delete -f ${KUBE_ROOT}/test/kubemark/hollow-kubelet.json &> /dev/null || true -kubectl delete -f ${KUBE_ROOT}/test/kubemark/kubemark-ns.json &> /dev/null || true +"${KUBECTL}" delete -f ${KUBE_ROOT}/test/kubemark/hollow-kubelet.json &> /dev/null || true +"${KUBECTL}" delete -f ${KUBE_ROOT}/test/kubemark/kubemark-ns.json &> /dev/null || true GCLOUD_COMMON_ARGS="--project ${PROJECT} --zone ${ZONE} --quiet"