mirror of https://github.com/k3s-io/k3s
Restore InstanceNotFound comment & logic
Otherwise node registration is broken on AWS.pull/8/head
parent
d057795f3b
commit
3988331c6c
|
@ -131,6 +131,7 @@ type Instances interface {
|
|||
// services cannot be used in this method to obtain nodeaddresses
|
||||
NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)
|
||||
// InstanceID returns the cloud provider ID of the node with the specified NodeName.
|
||||
// Note that if the instance does not exist or is no longer running, we must return ("", cloudprovider.InstanceNotFound)
|
||||
InstanceID(ctx context.Context, nodeName types.NodeName) (string, error)
|
||||
// InstanceType returns the type of the specified instance.
|
||||
InstanceType(ctx context.Context, name types.NodeName) (string, error)
|
||||
|
|
|
@ -1363,6 +1363,10 @@ func (c *Cloud) InstanceID(ctx context.Context, nodeName types.NodeName) (string
|
|||
}
|
||||
inst, err := c.getInstanceByNodeName(nodeName)
|
||||
if err != nil {
|
||||
if err == cloudprovider.InstanceNotFound {
|
||||
// The Instances interface requires that we return InstanceNotFound (without wrapping)
|
||||
return "", err
|
||||
}
|
||||
return "", fmt.Errorf("getInstanceByNodeName failed for %q with %q", nodeName, err)
|
||||
}
|
||||
return "/" + aws.StringValue(inst.Placement.AvailabilityZone) + "/" + aws.StringValue(inst.InstanceId), nil
|
||||
|
|
Loading…
Reference in New Issue