Merge pull request #14155 from olemarkus/ignore-no-such-entity

Fix no such entity check for iam profiles and roles
This commit is contained in:
Kubernetes Prow Robot 2022-08-21 02:45:35 -07:00 committed by GitHub
commit 45dc1f1cfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -2008,7 +2008,7 @@ func ListIAMRoles(cloud fi.Cloud, clusterName string) ([]*resources.Resource, er
klog.Warningf("failed to determine ownership of %q: %v", *r.RoleName, awserror)
return true
} else if awserror.StatusCode() == 404 {
} else if awsup.AWSErrorCode(err) == iam.ErrCodeNoSuchEntityException {
klog.Warningf("could not find instance profile %q. Resource may already have been deleted: %v", name, awserror)
return true
}
@ -2093,8 +2093,8 @@ func ListIAMInstanceProfiles(cloud fi.Cloud, clusterName string) ([]*resources.R
getRequest := &iam.GetInstanceProfileInput{InstanceProfileName: p.InstanceProfileName}
profileOutput, err := c.IAM().GetInstanceProfile(getRequest)
if err != nil {
if awserror, ok := err.(awserr.RequestFailure); ok {
if awserror.StatusCode() == 404 {
if awserror, ok := err.(awserr.Error); ok {
if awserror.Code() == iam.ErrCodeNoSuchEntityException {
klog.Warningf("could not find instance profile %q. Resource may already have been deleted: %v", *p.InstanceProfileName, awserror)
}
}