mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 04:32:37 +00:00
local-up-cluster changes: added help option, added error message for why docker ps fails and how to recover, added test to check if etcd is in your path to fail fast when not found.
from etcd.sh split the start process into validate fucntion + start function so that the validate piece can be reused elsewhere. the up-cluster script has been changed to remove duplicate docker logic to the one used in buid-tools/common.sh and the validate etcd function is now used here. moved docker daemon check function to util.sh and made function name changes and upstream changes.
This commit is contained in:
@@ -94,6 +94,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
function usage {
|
||||
echo "This script starts a local kube cluster. "
|
||||
echo "Example 0: hack/local-up-cluster.sh -h (this 'help' usage description)"
|
||||
echo "Example 1: hack/local-up-cluster.sh -o _output/dockerized/bin/linux/amd64/ (run from docker output)"
|
||||
echo "Example 2: hack/local-up-cluster.sh -O (auto-guess the bin path for your platform)"
|
||||
echo "Example 3: hack/local-up-cluster.sh (build a local copy of the source)"
|
||||
@@ -111,7 +112,7 @@ function guess_built_binary_path {
|
||||
|
||||
### Allow user to supply the source directory.
|
||||
GO_OUT=${GO_OUT:-}
|
||||
while getopts "o:O" OPTION
|
||||
while getopts "ho:O" OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
o)
|
||||
@@ -126,6 +127,10 @@ do
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
?)
|
||||
usage
|
||||
exit
|
||||
@@ -139,14 +144,6 @@ else
|
||||
echo "skipped the build."
|
||||
fi
|
||||
|
||||
function test_docker {
|
||||
${DOCKER[@]} ps 2> /dev/null 1> /dev/null
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Failed to successfully run 'docker ps', please verify that docker is installed and \$DOCKER_HOST is set correctly."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function test_rkt {
|
||||
if [[ -n "${RKT_PATH}" ]]; then
|
||||
${RKT_PATH} list 2> /dev/null 1> /dev/null
|
||||
@@ -680,8 +677,11 @@ EOF
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "${CONTAINER_RUNTIME}" == "docker" ]]; then
|
||||
test_docker
|
||||
# validate that etcd is: not running, in path, and has minimum required version.
|
||||
kube::etcd::validate
|
||||
|
||||
if [ "${CONTAINER_RUNTIME}" == "docker" ] && ! kube::util::ensure_docker_daemon_connectivity; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${CONTAINER_RUNTIME}" == "rkt" ]]; then
|
||||
|
Reference in New Issue
Block a user