From 5b9623342374517aafd154f5e8fb93831f11db50 Mon Sep 17 00:00:00 2001 From: Mik Vyatskov Date: Tue, 17 Jan 2017 13:29:54 +0100 Subject: [PATCH] Sync fluentd daemonset liveness probe with static pod liveness probe --- .../saltbase/salt/fluentd-gcp/fluentd-gcp.yaml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cluster/saltbase/salt/fluentd-gcp/fluentd-gcp.yaml b/cluster/saltbase/salt/fluentd-gcp/fluentd-gcp.yaml index d1816a4fe22..d7ec3f7463d 100644 --- a/cluster/saltbase/salt/fluentd-gcp/fluentd-gcp.yaml +++ b/cluster/saltbase/salt/fluentd-gcp/fluentd-gcp.yaml @@ -51,10 +51,23 @@ spec: - '/bin/sh' - '-c' - > - LIVENESS_THRESHOLD_SECONDS=${LIVENESS_THRESHOLD_SECONDS:-600}; + LIVENESS_THRESHOLD_SECONDS=${LIVENESS_THRESHOLD_SECONDS:-300}; + STUCK_THRESHOLD_SECONDS=${LIVENESS_THRESHOLD_SECONDS:-900}; + if [ ! -e /var/log/fluentd-buffers ]; + 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 + $LIVENESS_THRESHOLD_SECONDS` ]; then exit 1; fi; + if [ `date +%s` -gt `expr $LAST_MODIFIED_TIMESTAMP + $STUCK_THRESHOLD_SECONDS` ]; + then + rm -rf /var/log/fluentd-buffers; + exit 1; + fi; + if [ `date +%s` -gt `expr $LAST_MODIFIED_TIMESTAMP + $LIVENESS_THRESHOLD_SECONDS` ]; + then + exit 1; + fi; terminationGracePeriodSeconds: 30 volumes: - name: varlog