Merge pull request #29145 from yifan-gu/no_chtime

Automatic merge from submit-queue

rkt: Don't return if the service file doesn't exist when killing the pod

Remove an unused logic. Also this prevents the KillPod() from failing
when the service file doesn't exist. E.g., it can be removed by garbage
collection in a rare case:

1, There are already more than `gcPolicy.MaxContainers` containers running
   on the host.
2, The new pod(A) starts to run but doesn't enter 'RUNNING' state yet.
3, GC is triggered, and it sees the pod(A) is in an inactive state (not running),
   and the it needs to remove the pod to force the `gcPolicy.MaxContainers`.
4, GC fails to remove the pod because `rkt rm` fails when the pod is running,
   but it removes the service file anyway.
5, Follow up KillPod() call will fail because it cannot find the service file
   on disk.

Also this is possible only when the pod has been in prepared state for longer
than 1 min, which sounds like another issue.

cc @kubernetes/sig-rktnetes
This commit is contained in:
k8s-merge-robot 2016-07-21 05:20:15 -07:00 committed by GitHub
commit ac17b239b6

View File

@ -1649,13 +1649,6 @@ func (r *Runtime) KillPod(pod *api.Pod, runningPod kubecontainer.Pod, gracePerio
r.containerRefManager.ClearRef(c.ID)
}
// Touch the systemd service file to update the mod time so it will
// not be garbage collected too soon.
if err := r.os.Chtimes(serviceFile, time.Now(), time.Now()); err != nil {
glog.Errorf("rkt: Failed to change the modification time of the service file %q: %v", serviceName, err)
return err
}
// Since all service file have 'KillMode=mixed', the processes in
// the unit's cgroup will receive a SIGKILL if the normal stop timeouts.
reschan := make(chan string)