mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #44970 from Random-Liu/fix-stop-container-timeout
Automatic merge from submit-queue (batch tested with PRs 44970, 43618) CRI: Fix StopContainer timeout Fixes https://github.com/kubernetes/kubernetes/issues/44956. I verified this PR with the example provided in https://github.com/kubernetes/kubernetes/issues/44956, and now pod deletion will respect grace period timeout: ``` NAME READY STATUS RESTARTS AGE gracefully-terminating-pod 1/1 Terminating 0 6m ``` @dchen1107 @yujuhong @feiskyer /cc @kubernetes/sig-node-bugs
This commit is contained in:
commit
c3df35df7b
@ -209,7 +209,11 @@ func (r *RemoteRuntimeService) StartContainer(containerID string) error {
|
||||
|
||||
// StopContainer stops a running container with a grace period (i.e., timeout).
|
||||
func (r *RemoteRuntimeService) StopContainer(containerID string, timeout int64) error {
|
||||
ctx, cancel := getContextWithTimeout(r.timeout)
|
||||
ctx, cancel := getContextWithTimeout(time.Duration(timeout) * time.Second)
|
||||
if timeout == 0 {
|
||||
// Use default timeout if stop timeout is 0.
|
||||
ctx, cancel = getContextWithTimeout(r.timeout)
|
||||
}
|
||||
defer cancel()
|
||||
|
||||
_, err := r.runtimeClient.StopContainer(ctx, &runtimeapi.StopContainerRequest{
|
||||
|
Loading…
Reference in New Issue
Block a user