From 88ae15499e50ce9e78b03cd829f4a04c420dd362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20D=C4=85bek?= <373530+szemek@users.noreply.github.com> Date: Mon, 20 May 2024 21:55:41 +0200 Subject: [PATCH] [pod-sweeper] Skip pending pods that haven't even started yet Solves issue: ``` date: invalid date '+%s' /script/sweep-pod.sh: line 53: [: : integer expression expected ``` --- charts/airbyte-pod-sweeper/templates/configmap.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/charts/airbyte-pod-sweeper/templates/configmap.yaml b/charts/airbyte-pod-sweeper/templates/configmap.yaml index 96ce9350871..e02b9cbd6d8 100644 --- a/charts/airbyte-pod-sweeper/templates/configmap.yaml +++ b/charts/airbyte-pod-sweeper/templates/configmap.yaml @@ -52,6 +52,10 @@ data: POD_STATUS=`echo $POD | cut -d " " -f 2` POD_DATE_STR=`echo $POD | cut -d " " -f 3` POD_START_DATE_STR=`echo $POD | cut -d " " -f 4` + if [ "$POD_STATUS" = "Pending" ] && [ -z "$POD_DATE_STR" ] && [ -z "$POD_START_DATE_STR" ]; then + echo "Pod ${POD_NAME} hasn't started yet. Skipping..." + continue + fi POD_DATE=`date -d ${POD_DATE_STR:-$POD_START_DATE_STR} '+%s'` if [ -n "${RUNNING_TTL_MINUTES}" ] && [ "$POD_STATUS" = "Running" ]; then if [ "$POD_DATE" -lt "$RUNNING_DATE" ]; then