mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #1790 from jbeda/1678-fix-e2e
Deal with the case where a pod goes away after we list it.
This commit is contained in:
commit
180e90f7eb
@ -46,9 +46,34 @@ function validate() {
|
|||||||
num_running=0
|
num_running=0
|
||||||
for id in "${pod_id_list[@]+${pod_id_list[@]}}"; do
|
for id in "${pod_id_list[@]+${pod_id_list[@]}}"; do
|
||||||
local template_string current_status current_image host_ip
|
local template_string current_status current_image host_ip
|
||||||
|
|
||||||
|
# NB: This template string is a little subtle.
|
||||||
|
#
|
||||||
|
# Notes:
|
||||||
|
#
|
||||||
|
# The 'and' operator will return blank if any of the inputs are non-
|
||||||
|
# nil/false. If they are all set, then it'll return the last one.
|
||||||
|
#
|
||||||
|
# The container is name has a dash in it and so we can't use the simple
|
||||||
|
# syntax. Instead we need to quote that and use the 'index' operator.
|
||||||
|
#
|
||||||
|
# The value here is a structure with just a Time member. This is
|
||||||
|
# currently always set to a zero time.
|
||||||
|
#
|
||||||
|
# You can read about the syntax here: http://golang.org/pkg/text/template/
|
||||||
template_string="{{and ((index .CurrentState.Info \"${CONTROLLER_NAME}\").State.Running) .CurrentState.Info.net.State.Running}}"
|
template_string="{{and ((index .CurrentState.Info \"${CONTROLLER_NAME}\").State.Running) .CurrentState.Info.net.State.Running}}"
|
||||||
current_status=$($KUBECFG -template="${template_string}" get "pods/$id")
|
current_status=$($KUBECFG -template="${template_string}" get "pods/$id") || {
|
||||||
if [ "$current_status" != "{0001-01-01 00:00:00 +0000 UTC}" ]; then
|
if [[ $current_status =~ "pod \"${id}\" not found" ]]; then
|
||||||
|
echo " $id no longer exists"
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
echo " kubecfg failed with error:"
|
||||||
|
echo $current_status
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "$current_status" != "{0001-01-01 00:00:00 +0000 UTC}" ]]; then
|
||||||
echo " $id is created but not running"
|
echo " $id is created but not running"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user