mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 04:32:37 +00:00
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:
@@ -1786,7 +1786,27 @@ function start-kube-proxy {
|
|||||||
# $5: pod name, which should be either etcd or etcd-events
|
# $5: pod name, which should be either etcd or etcd-events
|
||||||
function prepare-etcd-manifest {
|
function prepare-etcd-manifest {
|
||||||
local host_name=${ETCD_HOSTNAME:-$(hostname -s)}
|
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 etcd_cluster=""
|
||||||
local cluster_state="new"
|
local cluster_state="new"
|
||||||
local etcd_protocol="http"
|
local etcd_protocol="http"
|
||||||
|
Reference in New Issue
Block a user