Commit dbc14b89 authored by Manuel Buil's avatar Manuel Buil

Fix race condition in cloud provider

Signed-off-by: 's avatarManuel Buil <mbuil@suse.com>
parent 5a923ab8
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment