mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Check Docker init PID is valid before we use it.
This gives us an error if the PID is not returned as we expect.
This commit is contained in:
parent
a5fdac2f3f
commit
da2f4b6d61
@ -121,7 +121,10 @@ func (f *FakeDockerClient) StartContainer(id string, hostConfig *docker.HostConf
|
||||
Name: id, // For testing purpose, we set name to id
|
||||
Config: &docker.Config{Image: "testimage"},
|
||||
HostConfig: hostConfig,
|
||||
State: docker.State{Running: true},
|
||||
State: docker.State{
|
||||
Running: true,
|
||||
Pid: 42,
|
||||
},
|
||||
}
|
||||
return f.Err
|
||||
}
|
||||
|
@ -961,6 +961,10 @@ func (kl *Kubelet) createPodInfraContainer(pod *api.BoundPod) (dockertools.Docke
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Ensure the PID actually exists, else we'll move ourselves.
|
||||
if containerInfo.State.Pid == 0 {
|
||||
return "", fmt.Errorf("failed to get init PID for Docker pod infra container %q", string(id))
|
||||
}
|
||||
return id, util.ApplyOomScoreAdj(containerInfo.State.Pid, podOomScoreAdj)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user