diff --git a/qinling/config.py b/qinling/config.py index 1e195f12..2ba042cd 100644 --- a/qinling/config.py +++ b/qinling/config.py @@ -126,7 +126,9 @@ kubernetes_opts = [ ), cfg.StrOpt( 'kube_host', - help='Kubernetes server address.' + default='127.0.0.1:8001', + help='Kubernetes server address, e.g. you can start a proxy to the ' + 'Kubernetes API server by using "kubectl proxy" command.' ), cfg.IPOpt( 'qinling_service_address', diff --git a/qinling_tempest_plugin/pre_test_hook.sh b/qinling_tempest_plugin/pre_test_hook.sh index 3d7c6c13..ecb1b68f 100644 --- a/qinling_tempest_plugin/pre_test_hook.sh +++ b/qinling_tempest_plugin/pre_test_hook.sh @@ -14,11 +14,13 @@ # This script is executed inside pre_test_hook function in devstack gate. -set -x +set -ex export localconf=$BASE/new/devstack/local.conf export QINLING_CONF=/etc/qinling/qinling.conf +# Install k8s cluster +bash $BASE/new/qinling/tools/gate/setup_gate.sh + echo -e '[[post-config|$QINLING_CONF]]\n[kubernetes]\n' >> $localconf echo -e 'qinling_service_address=${DEFAULT_HOST_IP}\n' >> $localconf -echo -e 'kube_host=${K8S_SERVICE_IP}:8001\n' >> $localconf diff --git a/tools/gate/funcs/kube.sh b/tools/gate/funcs/kube.sh index 146d4537..44397cf5 100755 --- a/tools/gate/funcs/kube.sh +++ b/tools/gate/funcs/kube.sh @@ -37,7 +37,7 @@ function kube_wait_for_pods { break || true sleep 1 now=$(date +%s) - [ $now -gt $end ] && echo containers failed to start. && \ + [ $now -gt $end ] && echo "containers failed to start." && \ kubectl get pods --namespace $1 -o wide && exit -1 done set -x @@ -72,7 +72,6 @@ function kube_wait_for_nodes { function kubeadm_aio_reqs_install { if [ "x$HOST_OS" == "xubuntu" ]; then - sudo apt-get update -y sudo apt-get install -y --no-install-recommends -qq \ docker.io \ jq diff --git a/tools/gate/setup_gate.sh b/tools/gate/setup_gate.sh index f57c730b..3f638c12 100755 --- a/tools/gate/setup_gate.sh +++ b/tools/gate/setup_gate.sh @@ -36,3 +36,8 @@ net_hosts_pre_kube # Setup the K8s Cluster bash ${WORK_DIR}/tools/gate/kubeadm_aio.sh + +# Starts a proxy to the Kubernetes API server in a screen session +sudo screen -S kube_proxy -X quit || true +sudo screen -dmS kube_proxy && screen -S kube_proxy -X screen -t kube_proxy +sudo screen -S kube_proxy -p kube_proxy -X stuff 'kubectl proxy --accept-hosts=".*" --address="0.0.0.0"\n' diff --git a/tools/kubeadm-aio/kubeadm-aio-launcher.sh b/tools/kubeadm-aio/kubeadm-aio-launcher.sh index c78183bd..4ad4e994 100755 --- a/tools/kubeadm-aio/kubeadm-aio-launcher.sh +++ b/tools/kubeadm-aio/kubeadm-aio-launcher.sh @@ -61,7 +61,7 @@ sudo docker run \ echo "Waiting for kubeconfig" set +x -end=$(($(date +%s) + 240)) +end=$(($(date +%s) + 600)) READY="False" while true; do if [ -f ${HOME}/.kubeadm-aio/admin.conf ]; then @@ -82,7 +82,7 @@ export KUBECONFIG=${HOME}/.kubeadm-aio/admin.conf echo "Waiting for node to be ready before continuing" set +x -end=$(($(date +%s) + 240)) +end=$(($(date +%s) + 600)) READY="False" while true; do READY=$(kubectl get nodes --no-headers=true | awk "{ print \$2 }" | head -1) @@ -94,9 +94,3 @@ while true; do sudo docker logs kubeadm-aio && exit -1 done set -x - -: ${PVC_BACKEND:="nfs"} -if [ "$PVC_BACKEND" == "nfs" ]; then - # Deploy NFS provisioner into enviromment - sudo docker exec kubeadm-aio openstack-helm-nfs-prep -fi