Commit f67879ea authored by Tim St. Clair's avatar Tim St. Clair

Check pod RestartPolicy before restarting unhealthy containers

parent 7ba48583
...@@ -1724,8 +1724,10 @@ func (dm *DockerManager) computePodContainerChanges(pod *api.Pod, runningPod kub ...@@ -1724,8 +1724,10 @@ func (dm *DockerManager) computePodContainerChanges(pod *api.Pod, runningPod kub
containersToKeep[containerID] = index containersToKeep[containerID] = index
continue continue
} }
glog.Infof("pod %q container %q is unhealthy (probe result: %v), it will be killed and re-created.", podFullName, container.Name, result) if pod.Spec.RestartPolicy != api.RestartPolicyNever {
containersToStart[index] = empty{} glog.Infof("pod %q container %q is unhealthy (probe result: %v), it will be killed and re-created.", podFullName, container.Name, result)
containersToStart[index] = empty{}
}
} }
// After the loop one of the following should be true: // After the loop one of the following should be true:
......
...@@ -1022,7 +1022,7 @@ func (r *runtime) SyncPod(pod *api.Pod, runningPod kubecontainer.Pod, podStatus ...@@ -1022,7 +1022,7 @@ func (r *runtime) SyncPod(pod *api.Pod, runningPod kubecontainer.Pod, podStatus
result, err := r.prober.ProbeLiveness(pod, podStatus, container, string(c.ID), c.Created) result, err := r.prober.ProbeLiveness(pod, podStatus, container, string(c.ID), c.Created)
// TODO(vmarmol): examine this logic. // TODO(vmarmol): examine this logic.
if err == nil && result != probe.Success { if err == nil && result != probe.Success && pod.Spec.RestartPolicy != api.RestartPolicyNever {
glog.Infof("Pod %q container %q is unhealthy (probe result: %v), it will be killed and re-created.", podFullName, container.Name, result) glog.Infof("Pod %q container %q is unhealthy (probe result: %v), it will be killed and re-created.", podFullName, container.Name, result)
restartPod = true restartPod = true
break break
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment