From a844523c208ed3b6a8e91a36cfbd97cd2d86f621 Mon Sep 17 00:00:00 2001 From: Bryan Moyles Date: Thu, 8 Mar 2018 19:14:53 -0500 Subject: [PATCH] Find most recent modified date for fluentd buffers recursively. Due to updates in Fluent v0.14, the buffers directory modified date is no longer updated when files inside the directory are changed. Therefore we must find the most recent modified date recursively to fix liveness probe. --- cluster/addons/fluentd-gcp/fluentd-gcp-ds.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cluster/addons/fluentd-gcp/fluentd-gcp-ds.yaml b/cluster/addons/fluentd-gcp/fluentd-gcp-ds.yaml index fce4eb58fc8..cd0a0129588 100644 --- a/cluster/addons/fluentd-gcp/fluentd-gcp-ds.yaml +++ b/cluster/addons/fluentd-gcp/fluentd-gcp-ds.yaml @@ -61,14 +61,14 @@ spec: then exit 1; fi; - LAST_MODIFIED_DATE=`stat /var/log/fluentd-buffers | grep Modify | sed -r "s/Modify: (.*)/\1/"`; - LAST_MODIFIED_TIMESTAMP=`date -d "$LAST_MODIFIED_DATE" +%s`; - if [ `date +%s` -gt `expr $LAST_MODIFIED_TIMESTAMP + $STUCK_THRESHOLD_SECONDS` ]; + touch -d "${STUCK_THRESHOLD_SECONDS} seconds ago" /tmp/marker-stuck; + if [[ -z "$(find /var/log/fluentd-buffers -type f -newer /tmp/marker-stuck -print -quit)" ]]; then rm -rf /var/log/fluentd-buffers; exit 1; fi; - if [ `date +%s` -gt `expr $LAST_MODIFIED_TIMESTAMP + $LIVENESS_THRESHOLD_SECONDS` ]; + touch -d "${LIVENESS_THRESHOLD_SECONDS} seconds ago" /tmp/marker-liveness; + if [[ -z "$(find /var/log/fluentd-buffers -type f -newer /tmp/marker-liveness -print -quit)" ]]; then exit 1; fi;