Install Docker in kube-init.sh
Also limit the loop to 5 mins. Change-Id: I889c923468202412c8a267ee37ea679675b8bd1a
This commit is contained in:
parent
046e4915f8
commit
df8b8fa5b1
|
@ -19,7 +19,7 @@ test_k8sclient
|
||||||
Tests for `k8sclient` module. Deploy Kubernetes using:
|
Tests for `k8sclient` module. Deploy Kubernetes using:
|
||||||
http://kubernetes.io/docs/getting-started-guides/docker/
|
http://kubernetes.io/docs/getting-started-guides/docker/
|
||||||
|
|
||||||
and then run this test.
|
and then run this test
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from testtools.testcase import unittest
|
from testtools.testcase import unittest
|
||||||
|
|
|
@ -16,6 +16,15 @@ trap "clean_exit" EXIT
|
||||||
# Switch off SE-Linux
|
# Switch off SE-Linux
|
||||||
setenforce 0
|
setenforce 0
|
||||||
|
|
||||||
|
# Install docker if needed
|
||||||
|
path_to_executable=$(which docker)
|
||||||
|
if [ -x "$path_to_executable" ] ; then
|
||||||
|
echo "Found Docker installation"
|
||||||
|
else
|
||||||
|
curl -sSL https://get.docker.io | sudo bash
|
||||||
|
fi
|
||||||
|
docker --version
|
||||||
|
|
||||||
# Get the latest stable version of kubernetes
|
# Get the latest stable version of kubernetes
|
||||||
export K8S_VERSION=$(curl -sS https://storage.googleapis.com/kubernetes-release/release/stable.txt)
|
export K8S_VERSION=$(curl -sS https://storage.googleapis.com/kubernetes-release/release/stable.txt)
|
||||||
echo "K8S_VERSION : ${K8S_VERSION}"
|
echo "K8S_VERSION : ${K8S_VERSION}"
|
||||||
|
@ -55,7 +64,8 @@ chmod 755 kubectl
|
||||||
./kubectl get nodes
|
./kubectl get nodes
|
||||||
|
|
||||||
echo "Waiting for master components to start..."
|
echo "Waiting for master components to start..."
|
||||||
while true; do
|
for i in {1..300}
|
||||||
|
do
|
||||||
running_count=$(./kubectl -s=http://127.0.0.1:8080 get pods --no-headers 2>/dev/null | grep "Running" | wc -l)
|
running_count=$(./kubectl -s=http://127.0.0.1:8080 get pods --no-headers 2>/dev/null | grep "Running" | wc -l)
|
||||||
# We expect to have 3 running pods - etcd, master and kube-proxy.
|
# We expect to have 3 running pods - etcd, master and kube-proxy.
|
||||||
if [ "$running_count" -ge 3 ]; then
|
if [ "$running_count" -ge 3 ]; then
|
||||||
|
@ -64,6 +74,7 @@ while true; do
|
||||||
echo -n "."
|
echo -n "."
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "SUCCESS"
|
echo "SUCCESS"
|
||||||
echo "Cluster created!"
|
echo "Cluster created!"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
Loading…
Reference in New Issue