diff --git a/tools/deployment/31_deploy_initinfra_target_node.sh b/tools/deployment/31_deploy_initinfra_target_node.sh index 638503a9b..5a0b3823f 100755 --- a/tools/deployment/31_deploy_initinfra_target_node.sh +++ b/tools/deployment/31_deploy_initinfra_target_node.sh @@ -15,14 +15,33 @@ set -xe export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"} +export TIMEOUT=${TIMEOUT:-60} +NODENAME="node01" # TODO need to run another config command after use-context to update kubeconfig echo "Switch context to target cluster and set manifest" airshipctl config use-context target-cluster-admin@target-cluster airshipctl config set-context target-cluster-admin@target-cluster --manifest dummy_manifest +end=$(($(date +%s) + $TIMEOUT)) +echo "Waiting $TIMEOUT seconds for $NODENAME to be created." +while true; do + if (kubectl --request-timeout 10s --kubeconfig $KUBECONFIG get nodes | grep -q $NODENAME) ; then + echo -e "\n$NODENAME found" + break + else + now=$(date +%s) + if [ $now -gt $end ]; then + echo -e "\n$NODENAME was not ready before TIMEOUT." + exit 1 + fi + echo -n . + sleep 10 + fi +done + # TODO remove taint -kubectl --kubeconfig $KUBECONFIG taint node node01 node-role.kubernetes.io/master- +kubectl --kubeconfig $KUBECONFIG taint node $NODENAME node-role.kubernetes.io/master- echo "Deploy infra to cluster" airshipctl phase apply initinfra --debug --wait-timeout 1000s