mirror of https://github.com/k3s-io/k3s
Allow curl --max-time to be configurable
In nested virutalized environments, the 1 second max-time is too low. Just bumping up WAIT_FOR_URL_API_SERVER does not work unless we bump up the max-time too. Let us just make it configurable like so folks can customize to their environment.pull/8/head
parent
c8841cea30
commit
1f4246957f
|
@ -23,6 +23,7 @@ kube::util::wait_for_url() {
|
|||
local prefix=${2:-}
|
||||
local wait=${3:-1}
|
||||
local times=${4:-30}
|
||||
local maxtime=${5:-1}
|
||||
|
||||
which curl >/dev/null || {
|
||||
kube::log::usage "curl must be installed"
|
||||
|
@ -32,7 +33,7 @@ kube::util::wait_for_url() {
|
|||
local i
|
||||
for i in $(seq 1 "$times"); do
|
||||
local out
|
||||
if out=$(curl --max-time 1 -gkfs "$url" 2>/dev/null); then
|
||||
if out=$(curl --max-time "$maxtime" -gkfs "$url" 2>/dev/null); then
|
||||
kube::log::status "On try ${i}, ${prefix}: ${out}"
|
||||
return 0
|
||||
fi
|
||||
|
|
|
@ -63,6 +63,7 @@ DNS_SERVER_IP=${KUBE_DNS_SERVER_IP:-10.0.0.10}
|
|||
DNS_DOMAIN=${KUBE_DNS_NAME:-"cluster.local"}
|
||||
KUBECTL=${KUBECTL:-cluster/kubectl.sh}
|
||||
WAIT_FOR_URL_API_SERVER=${WAIT_FOR_URL_API_SERVER:-60}
|
||||
MAX_TIME_FOR_URL_API_SERVER=${MAX_TIME_FOR_URL_API_SERVER:-1}
|
||||
ENABLE_DAEMON=${ENABLE_DAEMON:-false}
|
||||
HOSTNAME_OVERRIDE=${HOSTNAME_OVERRIDE:-"127.0.0.1"}
|
||||
EXTERNAL_CLOUD_PROVIDER=${EXTERNAL_CLOUD_PROVIDER:-false}
|
||||
|
@ -582,7 +583,7 @@ function start_apiserver {
|
|||
|
||||
# Wait for kube-apiserver to come up before launching the rest of the components.
|
||||
echo "Waiting for apiserver to come up"
|
||||
kube::util::wait_for_url "https://${API_HOST_IP}:${API_SECURE_PORT}/healthz" "apiserver: " 1 ${WAIT_FOR_URL_API_SERVER} \
|
||||
kube::util::wait_for_url "https://${API_HOST_IP}:${API_SECURE_PORT}/healthz" "apiserver: " 1 ${WAIT_FOR_URL_API_SERVER} ${MAX_TIME_FOR_URL_API_SERVER} \
|
||||
|| { echo "check apiserver logs: ${APISERVER_LOG}" ; exit 1 ; }
|
||||
|
||||
# Create kubeconfigs for all components, using client certs
|
||||
|
|
Loading…
Reference in New Issue