forked from Aslamlatheef/Openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d72d2c7
commit 6ac5f78
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# Date: 04/18/2017 | ||
# | ||
# Script Purpose: Cleanup completed or dead pods | ||
# Version : 1.0 | ||
# | ||
|
||
|
||
#Delete all Error, Completed, DeadlineExceeded, or ContainerCannotRun pods. | ||
oc get pods --all-namespaces --no-headers | awk '$4 == "Error" \ | ||
|| $4 == "Completed" \ | ||
|| $4 == "DeadlineExceeded" \ | ||
|| $4 == "ContainerCannotRun" \ | ||
{system("bash -c '\''oc delete pod -n "$1" "$2" '\''")}' | ||
|
||
#Force kill any hanging pods | ||
oc get pods --no-headers | awk '$4 == "Terminating" \ | ||
{system("bash -c '\''oc delete pod -n "$1" "$2" --grace-period=0 '\''")}' | ||
|
||
exit 0 |