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.
This commit is contained in:
Davanum Srinivas
2018-03-22 08:54:09 -04:00
parent c8841cea30
commit 1f4246957f
2 changed files with 4 additions and 2 deletions

View File

@@ -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