mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Forcing get_node_name to continue searching for a node name if the returned list of nodes doesn't include this one.
There was a race condition where the kubelet was restarting and we were querying the api server for this node.
This commit is contained in:
parent
03b3d599fe
commit
e87b537654
@ -979,14 +979,11 @@ def get_node_name():
|
|||||||
while time.time() < deadline:
|
while time.time() < deadline:
|
||||||
try:
|
try:
|
||||||
raw = check_output(cmd)
|
raw = check_output(cmd)
|
||||||
break
|
|
||||||
except CalledProcessError:
|
except CalledProcessError:
|
||||||
hookenv.log('Failed to get node name for node %s.'
|
hookenv.log('Failed to get node name for node %s.'
|
||||||
' Will retry.' % (gethostname()))
|
' Will retry.' % (gethostname()))
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
else:
|
continue
|
||||||
msg = 'Failed to get node name for node %s' % gethostname()
|
|
||||||
raise GetNodeNameFailed(msg)
|
|
||||||
|
|
||||||
result = json.loads(raw.decode('utf-8'))
|
result = json.loads(raw.decode('utf-8'))
|
||||||
if 'items' in result:
|
if 'items' in result:
|
||||||
@ -1004,6 +1001,8 @@ def get_node_name():
|
|||||||
|
|
||||||
# if we didn't match, just bail to the next node
|
# if we didn't match, just bail to the next node
|
||||||
break
|
break
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
msg = 'Failed to get node name for node %s' % gethostname()
|
msg = 'Failed to get node name for node %s' % gethostname()
|
||||||
raise GetNodeNameFailed(msg)
|
raise GetNodeNameFailed(msg)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user