From 9c6e43738ba8722d569469a4ff379e86e29628af Mon Sep 17 00:00:00 2001 From: groundnuty Date: Wed, 30 May 2018 14:58:07 +0200 Subject: [PATCH] fixed script to work with kubectl v1.9.2 and later. closes #5 caused by https://github.com/kubernetes/kubernetes/pull/60210 --- wait_for.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/wait_for.sh b/wait_for.sh index 295236c..22e190c 100755 --- a/wait_for.sh +++ b/wait_for.sh @@ -48,14 +48,26 @@ get_pod_state() { {{- range .items -}} {{- range .status.conditions -}} {{- if and (eq .type "Ready") (eq .status "False") -}} - {{ .status }} + {{- if .reason -}} + {{- if ne .reason "PodCompleted" -}} + {{ .status }} + {{- end -}} + {{- else -}} + {{ .status }} + {{- end -}} {{- end -}} {{- end -}} {{- end -}} {{- else -}} {{- range .status.conditions -}} {{- if and (eq .type "Ready") (eq .status "False") -}} - {{ .status }} + {{- if .reason -}} + {{- if ne .reason "PodCompleted" -}} + {{ .status }} + {{- end -}} + {{- else -}} + {{ .status }} + {{- end -}} {{- end -}} {{- end -}} {{- end -}}