Skip to content

Commit 06e6b4b

Browse files
committed
snc-library: Delete the failed pods before check for available one
Sometime pods goes to `ContainerStatusUnknown` state where it is not able to send the status to kubelet and it stays there till manually deleted and due to it our snc script fails. In this PR we are deleting the pods which are in failed state (which is the same for ContainerStatusUnknown one) and then checks the pods availablity. ``` + sleep 256 + all_pods_are_running_completed none + local ignoreNamespace=none + ./openshift-clients/linux/oc get pod --no-headers --all-namespaces '--field-selector=metadata.namespace!=none' + grep -v Running + grep -v Completed openshift-kube-apiserver installer-11-crc 0/1 ContainerStatusUnknown 1 19m + exit=1 + wait=512 + count=10 + '[' 10 -lt 10 ']' + echo 'Retry 10/10 exited 1, no more retries left.' Retry 10/10 exited 1, no more retries left. ``` fixes: #920
1 parent 0d4dfbf commit 06e6b4b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

snc-library.sh

+5
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,13 @@ function no_operators_degraded() {
241241
${OC} get co -ojsonpath='{.items[*].status.conditions[?(@.type=="Degraded")].status}' | grep -v True
242242
}
243243

244+
function retry_failed_pods() {
245+
${OC} delete pods --field-selector=status.phase=Failed -A
246+
}
247+
244248
function all_pods_are_running_completed() {
245249
local ignoreNamespace=$1
250+
retry_failed_pods
246251
! ${OC} get pod --no-headers --all-namespaces --field-selector=metadata.namespace!="${ignoreNamespace}" | grep -v Running | grep -v Completed
247252
}
248253

0 commit comments

Comments
 (0)