kubelet/dockertools: clear container reference when killing a container.

pull/6/head
Yifan Gu 2015-08-21 15:08:12 -07:00
parent 00e34429e0
commit 6ced66249d
3 changed files with 2 additions and 3 deletions

View File

@ -46,8 +46,6 @@ func (c *RefManager) SetRef(id string, ref *api.ObjectReference) {
}
// ClearRef forgets the given container id and its associated container reference.
// TODO(yifan): This is currently never called. Consider to remove this function,
// or figure out when to clear the references.
func (c *RefManager) ClearRef(id string) {
c.Lock()
defer c.Unlock()

View File

@ -1294,6 +1294,7 @@ func (dm *DockerManager) killContainer(containerID types.UID, container *api.Con
} else {
// TODO: pass reason down here, and state, or move this call up the stack.
dm.recorder.Eventf(ref, "Killing", "Killing with docker id %v", util.ShortenString(ID, 12))
dm.containerRefManager.ClearRef(ID)
}
return err
}

View File

@ -726,6 +726,7 @@ func (r *runtime) GetPods(all bool) ([]*kubecontainer.Pod, error) {
}
// KillPod invokes 'systemctl kill' to kill the unit that runs the pod.
// TODO(yifan): Handle network plugin.
func (r *runtime) KillPod(pod *api.Pod, runningPod kubecontainer.Pod) error {
glog.V(4).Infof("Rkt is killing pod: name %q.", runningPod.Name)
serviceName := makePodServiceFileName(runningPod.ID)
@ -948,7 +949,6 @@ func (r *runtime) SyncPod(pod *api.Pod, runningPod kubecontainer.Pod, podStatus
}
if restartPod {
// TODO(yifan): Handle network plugin.
if err := r.KillPod(pod, runningPod); err != nil {
return err
}