Skip to content

Commit

Permalink
Pod Sweeper: fix parsing missing date (#11781)
Browse files Browse the repository at this point in the history
  • Loading branch information
prasrvenkat authored Apr 26, 2022
1 parent 2a1b7b8 commit f1c6f19
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kube/resources/pod-sweeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ data:
# Longer time window for pods in error (to debug)
NON_SUCCESS_DATE_STR=`date -d 'now - 24 hours' --utc -Ins`
NON_SUCCESS_DATE=`date -d $NON_SUCCESS_DATE_STR +%s`
# default time to use in case its unavailable from kubectl
DEFAULT=`date --utc -Ins`
(
IFS=$'\n'
for POD in `get_worker_pods`; do
IFS=' '
POD_NAME=`echo $POD | cut -d " " -f 1`
POD_STATUS=`echo $POD | cut -d " " -f 2`
POD_DATE_STR=`echo $POD | cut -d " " -f 3`
POD_DATE=`date -d $POD_DATE_STR '+%s'`
POD_DATE=`date -d ${POD_DATE_STR:-$DEFAULT} '+%s'`
if [ "$POD_STATUS" = "Succeeded" ]; then
if [ "$POD_DATE" -lt "$SUCCESS_DATE" ]; then
delete_worker_pod "$POD_NAME" "$POD_STATUS" "$POD_DATE_STR"
Expand Down

0 comments on commit f1c6f19

Please sign in to comment.