mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
Test for certificate error and prompt to regenerate
If the docker-machine certificates get in a bad state, the current behavior causes an infinite loop waiting for `docker-machine env` to return. Now it will echo the certificate error and prompt the user to regenerate.
This commit is contained in:
parent
c0579af684
commit
d3208c6c3f
@ -201,8 +201,14 @@ function kube::build::prepare_docker_machine() {
|
|||||||
}
|
}
|
||||||
docker-machine start "${DOCKER_MACHINE_NAME}" &> /dev/null
|
docker-machine start "${DOCKER_MACHINE_NAME}" &> /dev/null
|
||||||
# it takes `docker-machine env` a few seconds to work if the machine was just started
|
# it takes `docker-machine env` a few seconds to work if the machine was just started
|
||||||
while ! docker-machine env ${DOCKER_MACHINE_NAME} &> /dev/null; do
|
local docker_machine_out
|
||||||
sleep 1
|
while ! docker_machine_out=$(docker-machine env "${DOCKER_MACHINE_NAME}" 2>&1); do
|
||||||
|
if [[ ${docker_machine_out} =~ "Error checking TLS connection" ]]; then
|
||||||
|
echo ${docker_machine_out}
|
||||||
|
docker-machine regenerate-certs ${DOCKER_MACHINE_NAME}
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
eval $(docker-machine env "${DOCKER_MACHINE_NAME}")
|
eval $(docker-machine env "${DOCKER_MACHINE_NAME}")
|
||||||
kube::log::status "A Docker host using docker-machine named '${DOCKER_MACHINE_NAME}' is ready to go!"
|
kube::log::status "A Docker host using docker-machine named '${DOCKER_MACHINE_NAME}' is ready to go!"
|
||||||
|
Loading…
Reference in New Issue
Block a user