Merge pull request #55020 from derekwaynecarr/fix-spam

Automatic merge from submit-queue. 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>.

StopPodSandbox should not log when container is already removed

**What this PR does / why we need it**:
StopPodSandbox should not log when a container is already gone.  It should only log if it could not stop and the container was still present.

Fixes https://github.com/kubernetes/kubernetes/issues/55021

**Special notes for your reviewer**:
This was seen in our production logs, need to eliminate spam.

**Release note**:
```release-note
NONE
```
pull/6/head
Kubernetes Submit Queue 2017-11-02 19:48:31 -07:00 committed by GitHub
commit 0575f72832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -239,9 +239,9 @@ func (ds *dockerService) StopPodSandbox(podSandboxID string) error {
}
}
if err := ds.client.StopContainer(podSandboxID, defaultSandboxGracePeriod); err != nil {
glog.Errorf("Failed to stop sandbox %q: %v", podSandboxID, err)
// Do not return error if the container does not exist
if !libdocker.IsContainerNotFoundError(err) {
glog.Errorf("Failed to stop sandbox %q: %v", podSandboxID, err)
errList = append(errList, err)
}
}