mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #23678 from gmarek/kubemark
Kubemark uses kubectl from the repo
This commit is contained in:
commit
58cc06c458
@ -27,6 +27,8 @@ EVENT_STORE_NAME="${INSTANCE_PREFIX}-event-store"
|
|||||||
|
|
||||||
RETRIES=3
|
RETRIES=3
|
||||||
|
|
||||||
|
export KUBECTL="${KUBE_ROOT}/cluster/kubectl.sh"
|
||||||
|
|
||||||
# Runs gcloud compute command with the given parameters. Up to $RETRIES will be made
|
# Runs gcloud compute command with the given parameters. Up to $RETRIES will be made
|
||||||
# to execute the command.
|
# to execute the command.
|
||||||
# arguments:
|
# arguments:
|
||||||
|
@ -18,11 +18,6 @@
|
|||||||
|
|
||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
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"
|
source "${KUBE_ROOT}/test/kubemark/common.sh"
|
||||||
|
|
||||||
RUN_FROM_DISTRO=${RUN_FROM_DISTRO:-false}
|
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 "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
|
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 "${KUBE_ROOT}"/test/kubemark/kubemark-ns.json
|
||||||
kubectl create -f "${KUBECONFIG_SECRET}" --namespace="kubemark"
|
"${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/hollow-node.json --namespace="kubemark"
|
||||||
|
|
||||||
rm "${KUBECONFIG_SECRET}"
|
rm "${KUBECONFIG_SECRET}"
|
||||||
|
|
||||||
echo "Waiting for all HollowNodes to become Running..."
|
echo "Waiting for all HollowNodes to become Running..."
|
||||||
start=$(date +%s)
|
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))
|
ready=$(($(echo "${nodes}" | grep -v "NotReady" | wc -l) - 1))
|
||||||
|
|
||||||
until [[ "${ready}" -ge "${NUM_NODES}" ]]; do
|
until [[ "${ready}" -ge "${NUM_NODES}" ]]; do
|
||||||
@ -229,14 +224,14 @@ until [[ "${ready}" -ge "${NUM_NODES}" ]]; do
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Timeout waiting for all HollowNodes to become Running"
|
echo "Timeout waiting for all HollowNodes to become Running"
|
||||||
# Try listing nodes again - if it fails it means that API server is not responding
|
# 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}."
|
echo "Found only ${ready} ready Nodes while waiting for ${NUM_NODES}."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Got error while trying to list Nodes. Probably API server is down."
|
echo "Got error while trying to list Nodes. Probably API server is down."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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))
|
ready=$(($(echo "${nodes}" | grep -v "NotReady" | wc -l) - 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
|||||||
|
|
||||||
source "${KUBE_ROOT}/test/kubemark/common.sh"
|
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/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/kubemark-ns.json &> /dev/null || true
|
||||||
|
|
||||||
GCLOUD_COMMON_ARGS="--project ${PROJECT} --zone ${ZONE} --quiet"
|
GCLOUD_COMMON_ARGS="--project ${PROJECT} --zone ${ZONE} --quiet"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user