Add readiness and liveness probes for gerrit-master

The kubelet did not have a way to see, whether Gerrit was running in the
gerrit-master pods created by the gerrit-master helm chart. Thus, the
readiness of the pod was reported to early, since by default just the
start of the entrypoint script is used and Gerrit startup took a few
seconds longer. Further, if Gerrit crashed, the pod would not restart,
since 'tail' was the process running in the foreground and thus used by
default to check the container health.

This change adds a readiness- and liveness probe to the gerrit-master
container in the respective pod and chart. These probes check for
a successful HTTP-connection on port 8080 of the pod, which is used to
connect to Gerrit. The initial delay and probe period can be configured
in the chart.

Change-Id: Ia2e13dbe809a4ab3168729614efb8ff064abfd2e
diff --git a/helm-charts/gerrit-master/templates/gerrit-master.deployment.yaml b/helm-charts/gerrit-master/templates/gerrit-master.deployment.yaml
index d23b647..61c3193 100644
--- a/helm-charts/gerrit-master/templates/gerrit-master.deployment.yaml
+++ b/helm-charts/gerrit-master/templates/gerrit-master.deployment.yaml
@@ -92,7 +92,8 @@
         image: {{ template "registry" . }}{{ .Values.gerritMaster.images.gerritMaster }}:{{ .Values.images.version }}
         imagePullPolicy: {{ .Values.images.imagePullPolicy }}
         ports:
-        - containerPort: 8080
+        - name: gerrit-port
+          containerPort: 8080
         volumeMounts:
         - name: gerrit-site
           mountPath: "/var/gerrit"
@@ -118,6 +119,16 @@
         {{- end }}
         resources:
 {{ toYaml .Values.gerritMaster.resources | indent 10 }}
+        livenessProbe:
+          httpGet:
+            path: /config/server/version
+            port: gerrit-port
+{{ toYaml .Values.gerritMaster.livenessProbe | indent 10 }}
+        readinessProbe:
+          httpGet:
+            path: /config/server/version
+            port: gerrit-port
+{{ toYaml .Values.gerritMaster.readinessProbe | indent 10 }}
       volumes:
       - name: gerrit-site
         emptyDir: {}
diff --git a/helm-charts/gerrit-master/values.yaml b/helm-charts/gerrit-master/values.yaml
index 962260f..8656eff 100644
--- a/helm-charts/gerrit-master/values.yaml
+++ b/helm-charts/gerrit-master/values.yaml
@@ -79,6 +79,14 @@
       cpu: 1
       memory: 6Gi
 
+  livenessProbe:
+    initialDelaySeconds: 30
+    periodSeconds: 5
+
+  readinessProbe:
+    initialDelaySeconds: 5
+    periodSeconds: 1
+
   logging:
     persistence:
       enabled: true