From 33efd05ef8b33717ec9e5373da11ba20b7978163 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Fri, 5 May 2017 11:51:09 -0500 Subject: [PATCH] KubeADM-AIO container tidy Change-Id: I08696a512d94595b595bb41d27ea72a4b0e48ccd --- tools/gate/basic_launch.sh | 6 ++-- tools/kubeadm-aio/kubeadm-aio-launcher.sh | 38 +++++++++++++++++------ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/tools/gate/basic_launch.sh b/tools/gate/basic_launch.sh index 2c9d1fb204..9791e02098 100755 --- a/tools/gate/basic_launch.sh +++ b/tools/gate/basic_launch.sh @@ -29,7 +29,7 @@ kube_wait_for_pods openstack 600 helm install local/keystone --name=keystone --namespace=openstack kube_wait_for_pods openstack 240 -helm install local/glance --name=glance --namespace=openstack --values=${WORK_DIR}/tools/overrides/glance.yaml -helm install local/nova --name=nova --namespace=openstack --values=${WORK_DIR}/tools/overrides/nova.yaml --set=conf.nova.libvirt.nova.conf.virt_type=qemu -helm install local/neutron --name=neutron --namespace=openstack --values=${WORK_DIR}/tools/overrides/neutron.yaml +helm install local/glance --name=glance --namespace=openstack --values=${WORK_DIR}/tools/overrides/mvp/glance.yaml +helm install local/nova --name=nova --namespace=openstack --values=${WORK_DIR}/tools/overrides/mvp/nova.yaml --set=conf.nova.libvirt.nova.conf.virt_type=qemu +helm install local/neutron --name=neutron --namespace=openstack --values=${WORK_DIR}/tools/overrides/mvp/neutron.yaml kube_wait_for_pods openstack 600 diff --git a/tools/kubeadm-aio/kubeadm-aio-launcher.sh b/tools/kubeadm-aio/kubeadm-aio-launcher.sh index abc4c80915..305dc6cf2c 100755 --- a/tools/kubeadm-aio/kubeadm-aio-launcher.sh +++ b/tools/kubeadm-aio/kubeadm-aio-launcher.sh @@ -53,23 +53,41 @@ sudo docker run \ --env KUBE_VERSION=${KUBE_VERSION} \ ${KUBEADM_IMAGE} -# Wait for kubeconfig -while [[ ! -f ${HOME}/.kubeadm-aio/admin.conf ]]; do - echo "Waiting for kubeconfig" - sleep 2 +echo "Waiting for kubeconfig" +set +x +end=$(($(date +%s) + 120)) +READY="False" +while true; do + if [ -f ${HOME}/.kubeadm-aio/admin.conf ]; then + READY="True" + fi + [ $READY == "True" ] && break || true + sleep 1 + now=$(date +%s) + [ $now -gt $end ] && \ + echo "KubeADM did not generate kubectl config in time" && \ + docker logs kubeadm-aio && exit -1 done +set -x # Set perms of kubeconfig and set env-var sudo chown $(id -u):$(id -g) ${HOME}/.kubeadm-aio/admin.conf export KUBECONFIG=${HOME}/.kubeadm-aio/admin.conf -# Wait for node to be ready before continuing -NODE_STATUS="Unknown" -while [[ $NODE_STATUS != "Ready" ]]; do - NODE_STATUS=$(kubectl get nodes --no-headers=true | awk "{ print \$2 }" | head -1) - echo "Current node status: ${NODE_STATUS}" - sleep 2 +echo "Waiting for node to be ready before continuing" +set +x +end=$(($(date +%s) + 240)) +READY="False" +while true; do + READY=$(kubectl get nodes --no-headers=true | awk "{ print \$2 }" | head -1) + [ $READY == "Ready" ] && break || true + sleep 1 + now=$(date +%s) + [ $now -gt $end ] && \ + echo "Kube node did not register as ready in time" && \ + docker logs kubeadm-aio && exit -1 done +set -x # Initialize Helm helm init