From 8a3150b68e6b5de7e62fb2384b0d337a389743e2 Mon Sep 17 00:00:00 2001
From: Xiang Dai <764524258@qq.com>
Date: Tue, 26 Mar 2019 17:22:19 +0800
Subject: [PATCH] Add health check

Signed-off-by: Xiang Dai <764524258@qq.com>
---
 .../helm/templates/promtail/daemonset.yaml    |  8 +++++++
 production/helm/values.yaml                   | 24 +++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/production/helm/templates/promtail/daemonset.yaml b/production/helm/templates/promtail/daemonset.yaml
index ca946465..f9135361 100644
--- a/production/helm/templates/promtail/daemonset.yaml
+++ b/production/helm/templates/promtail/daemonset.yaml
@@ -57,6 +57,14 @@ spec:
               name: http-metrics
           securityContext:
             {{- toYaml .Values.promtail.securityContext | nindent 12 }}
+          {{- if .Values.promtail.livenessProbe }}
+          livenessProbe:
+            {{- toYaml .Values.promtail.livenessProbe | nindent 12 }}
+          {{- end }}
+          {{- if .Values.promtail.livenessProbe }}
+          readinessProbe:
+            {{- toYaml .Values.promtail.readinessProbe | nindent 12 }}
+          {{- end }}
           resources:
             {{- toYaml .Values.promtail.resources | nindent 12 }}
       nodeSelector:
diff --git a/production/helm/values.yaml b/production/helm/values.yaml
index bac543bd..5f3cf351 100644
--- a/production/helm/values.yaml
+++ b/production/helm/values.yaml
@@ -158,6 +158,30 @@ promtail:
       mountPath: /var/lib/docker/containers
       readOnly: true
 
+  readinessProbe:
+    failureThreshold: 5
+    exec:
+      command:
+      - /bin/sh
+      - -c
+      - /bin/ps -ef | grep promtail | grep -v grep
+    initialDelaySeconds: 10
+    periodSeconds: 10
+    successThreshold: 1
+    timeoutSeconds: 1
+
+  livenessProbe:
+    failureThreshold: 5
+    exec:
+      command:
+      - /bin/sh
+      - -c
+      - /bin/ps -ef | grep promtail | grep -v grep
+    initialDelaySeconds: 10
+    periodSeconds: 10
+    successThreshold: 1
+    timeoutSeconds: 1
+
   resources: {}
   #  limits:
   #    cpu: 200m
-- 
GitLab