mirror of https://github.com/k3s-io/k3s
Merge pull request #54720 from MrHohn/gce-cleanup-get-instance-error
Automatic merge from submit-queue (batch tested with PRs 54437, 54714, 54720). 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>. Don't log error in getInstanceFromProjectInZoneByName() **What this PR does / why we need it**: In function `getInstanceByName()` we attempt to get instance by name from all zones, presumably we might hit multiple not-found errors. Logging every such error seems misleading while debugging. This PR makes it only logs non not-found errors while getting instance. If eventually no instance is found, an InstanceNotFound error will be returned as well. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #NONE **Special notes for your reviewer**: /assign @dnardo @nicksardo **Release note**: ```release-note NONE ```pull/6/head
commit
57f6c9dd39
|
@ -488,6 +488,7 @@ func (gce *GCECloud) getInstanceByName(name string) (*gceInstance, error) {
|
|||
if isHTTPErrorCode(err, http.StatusNotFound) {
|
||||
continue
|
||||
}
|
||||
glog.Errorf("getInstanceByName: failed to get instance %s in zone %s; err: %v", name, zone, err)
|
||||
return nil, err
|
||||
}
|
||||
return instance, nil
|
||||
|
@ -502,7 +503,6 @@ func (gce *GCECloud) getInstanceFromProjectInZoneByName(project, zone, name stri
|
|||
res, err := gce.service.Instances.Get(project, zone, name).Do()
|
||||
mc.Observe(err)
|
||||
if err != nil {
|
||||
glog.Errorf("getInstanceFromProjectInZoneByName: failed to get instance %s; err: %v", name, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue