Created
September 10, 2018 17:56
-
-
Save lsloan/ae9999dbe076129131fda51471546e46 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -- | |
# delete pods that have a status of "Completed" or "Error" | |
oc get pods | tail -n +2 | awk '($3 == "Completed" || $3 == "Error") {print $1}' | xargs -I% -L1 oc delete pod/% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO: Learn more about the "
-o jsonpath='…'
" option to oc to get just the data about completed or error pods. That will eliminate thetail
andawk
parts of the command.