Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove timeout for ipamd startup #874

Merged
merged 3 commits into from
Jun 24, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,37 @@ AWS_VPC_K8S_PLUGIN_LOG_LEVEL=${AWS_VPC_K8S_PLUGIN_LOG_LEVEL:-"Debug"}

AWS_VPC_K8S_CNI_CONFIGURE_RPFILTER=${AWS_VPC_K8S_CNI_CONFIGURE_RPFILTER:-"true"}

# Checks for IPAM connectivity on localhost port 50051, retrying connectivity
# check with a timeout of 36 seconds
# Number of seconds to wait checking for healthy ipamd. We default this to 90 seconds
# because ipamd needs kube-proxy to be running in order to contact the Kubernetes API
# server and sometimes it can take a little while for kube-proxy to start (or restart
# after an upgrade)
IPAMD_TIMEOUT_SECONDS=${IPAMD_TIMEOUT_SECONDS:-90}

# Check for ipamd connectivity on localhost port 50051
wait_for_ipam() {
local __sleep_time=0
local __elapsed_time=0
local __time_left=$IPAMD_TIMEOUT_SECONDS

until [ $__sleep_time -eq 8 ]; do
sleep $((__sleep_time++))
while :
do
if ./grpc-health-probe -addr 127.0.0.1:50051 >/dev/null 2>&1; then
return 0
fi
# We sleep for 1 second, then 2 seconds, then 3 seconds, etc
__sleep_time=$(( sleep_time++ ))
__time_left=$(( __time_left - __sleep_time ))
if [ $__time_left -le 0 ]; then
# Sleep for the remainder of time before timeout and check one more time
sleep $(( IPAMD_TIMEOUT_SECONDS - __elapsed_time ))
if ./grpc-health-probe -addr 127.0.0.1:50051 >/dev/null 2>&1; then
return 0
fi
return 1
fi
__elapsed_time=$(( __elapsed_time + __sleep_time ))
sleep $__sleep_time
done
return 1
}

# If there is no init container, copy the required files
Expand Down