Merge pull request #101781 from ptabor/20210506-retry-dns-resolve
Retry hostname->IP: [Errno -2] Name or service not known
This commit is contained in:
commit
9c5cefb230
@ -1786,7 +1786,27 @@ function start-kube-proxy {
|
||||
# $5: pod name, which should be either etcd or etcd-events
|
||||
function prepare-etcd-manifest {
|
||||
local host_name=${ETCD_HOSTNAME:-$(hostname -s)}
|
||||
local -r host_ip=$(python3 -c "import socket;print(socket.gethostbyname(\"${host_name}\"))")
|
||||
|
||||
local resolve_host_script_py='
|
||||
import socket
|
||||
import time
|
||||
import sys
|
||||
|
||||
timeout_sec=300
|
||||
|
||||
def resolve(host):
|
||||
for attempt in range(timeout_sec):
|
||||
try:
|
||||
print(socket.gethostbyname(host))
|
||||
break
|
||||
except Exception as e:
|
||||
sys.stderr.write("error: resolving host %s to IP failed: %s\n" % (host, e))
|
||||
time.sleep(1)
|
||||
continue
|
||||
|
||||
'
|
||||
|
||||
local -r host_ip=$(python3 -c "${resolve_host_script_py}"$'\n'"resolve(\"${host_name}\")")
|
||||
local etcd_cluster=""
|
||||
local cluster_state="new"
|
||||
local etcd_protocol="http"
|
||||
|
Loading…
Reference in New Issue
Block a user