Skip probe if container ID not yet set

If the container status exists but the container hasn't been created yet, it won't have an ID.
Have the probe wait for a valid status if the container ID is not yet set; otherwise, you'll see the
following cryptic log message from runtime.go: invalid container ID: "".
This commit is contained in:
Andy Goldstein
2016-02-23 14:23:07 -05:00
parent f5082b6dd7
commit 51251ef5c1

View File

@@ -152,9 +152,9 @@ func (w *worker) doProbe() (keepGoing bool) {
}
c, ok := api.GetContainerStatus(status.ContainerStatuses, w.container.Name)
if !ok {
if !ok || len(c.ContainerID) == 0 {
// Either the container has not been created yet, or it was deleted.
glog.V(3).Infof("Non-existant container probed: %v - %v",
glog.V(3).Infof("Probe target container not found: %v - %v",
format.Pod(w.pod), w.container.Name)
return true // Wait for more information.
}