mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #64367 from justinsb/fix_instancenotfound
Automatic merge from submit-queue (batch tested with PRs 64308, 64367, 64165, 64274). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Restore InstanceNotFound comment & logic Otherwise node deregistration is broken on AWS. ```release-note NONE ```
This commit is contained in:
commit
60d72f1d2e
@ -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
Block a user