mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
runonce: isPodRunning returns no error
This commit is contained in:
parent
8f010c3ec0
commit
0fc5e68207
@ -94,11 +94,7 @@ func (kl *Kubelet) runPod(pod Pod) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get kubelet docker containers: %v", err)
|
return fmt.Errorf("failed to get kubelet docker containers: %v", err)
|
||||||
}
|
}
|
||||||
running, err := kl.isPodRunning(pod, dockerContainers)
|
if running := kl.isPodRunning(pod, dockerContainers); running {
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error checking pod status: %v", err)
|
|
||||||
}
|
|
||||||
if running {
|
|
||||||
glog.Infof("pod %q containers running", pod.Name)
|
glog.Infof("pod %q containers running", pod.Name)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -118,12 +114,12 @@ func (kl *Kubelet) runPod(pod Pod) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// isPodRunning returns true if all containers of a manifest are running.
|
// isPodRunning returns true if all containers of a manifest are running.
|
||||||
func (kl *Kubelet) isPodRunning(pod Pod, dockerContainers dockertools.DockerContainers) (bool, error) {
|
func (kl *Kubelet) isPodRunning(pod Pod, dockerContainers dockertools.DockerContainers) bool {
|
||||||
for _, container := range pod.Manifest.Containers {
|
for _, container := range pod.Manifest.Containers {
|
||||||
if dockerContainer, found, _ := dockerContainers.FindPodContainer(GetPodFullName(&pod), pod.Manifest.UUID, container.Name); !found || dockerContainer.Status != "running" {
|
if dockerContainer, found, _ := dockerContainers.FindPodContainer(GetPodFullName(&pod), pod.Manifest.UUID, container.Name); !found || dockerContainer.Status != "running" {
|
||||||
glog.Infof("container %q not found (%v) or not running: %#v", container.Name, found, dockerContainer)
|
glog.Infof("container %q not found (%v) or not running: %#v", container.Name, found, dockerContainer)
|
||||||
return false, nil
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true, nil
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user