mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Fix race condition in cloud provider
Signed-off-by: Manuel Buil <mbuil@suse.com>
This commit is contained in:
parent
5a923ab8dc
commit
dbc14b8990
@ -36,9 +36,12 @@ func (k *k3s) InstanceID(ctx context.Context, nodeName types.NodeName) (string,
|
||||
return "", errors.New("Node informer has not synced yet")
|
||||
}
|
||||
|
||||
_, err := k.nodeInformer.Lister().Get(string(nodeName))
|
||||
node, err := k.nodeInformer.Lister().Get(string(nodeName))
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Failed to find node %s: %v", nodeName, err)
|
||||
return "", fmt.Errorf("failed to get node %s: %w", nodeName, err)
|
||||
}
|
||||
if (node.Annotations[InternalIPKey] == "") && (node.Labels[InternalIPKey] == "") {
|
||||
return string(nodeName), errors.New("address annotations not yet set")
|
||||
}
|
||||
return string(nodeName), nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user