mirror of https://github.com/k3s-io/k3s
Fix race condition in cloud provider
Signed-off-by: Manuel Buil <mbuil@suse.com>pull/4218/head
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")
|
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 {
|
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
|
return string(nodeName), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue