Skip to content

Commit

Permalink
Handle wrapped error for InvalidInstanceID.NotFound in InstanceExists…
Browse files Browse the repository at this point in the history
…ByProviderID

datadog:patch
  • Loading branch information
nyodas committed May 3, 2023
1 parent 72fbce3 commit 04a0269
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions staging/src/k8s.io/legacy-cloud-providers/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -1892,8 +1892,12 @@ func isAWSErrorInstanceNotFound(err error) bool {
if awsError, ok := err.(awserr.Error); ok {
if awsError.Code() == ec2.UnsuccessfulInstanceCreditSpecificationErrorCodeInvalidInstanceIdNotFound {
return true
}
}
} else if strings.Contains(err.Error(), ec2.UnsuccessfulInstanceCreditSpecificationErrorCodeInvalidInstanceIdNotFound) {
// In places like https://github.com/kubernetes/cloud-provider-aws/blob/1c6194aad0122ab44504de64187e3d1a7415b198/pkg/providers/v1/aws.go#L1007,
// the error has been transformed into something else so check the error string to see if it contains the error code we're looking for.
return true
}
}

return false
}
Expand Down

0 comments on commit 04a0269

Please sign in to comment.