From 3061ae3896c71a4c7c73986c9c9cbf6b182c3a7a Mon Sep 17 00:00:00 2001
From: "Huang,Sophie(sh879n)" <sh879n@att.com>
Date: Fri, 14 Dec 2018 09:39:10 -0600
Subject: [PATCH] Implemented livenessProbe for different OpenStack api
 containers

LivenessProbe is added to the below deployments:
  glance-api
  glance-registry
  heat-api
  heat-cfn
  horizon
  keystone-api
  nova-api-metadata
  nova-api-osapi
  nova-placement-api

Change-Id: I76b8cafa437855eeb42b77e88da6e3c514a3ac90
Signed-off-by: Huang,Sophie(sh879n) <sh879n@att.com>
---
 glance/templates/deployment-api.yaml        | 4 ++++
 glance/templates/deployment-registry.yaml   | 4 ++++
 heat/templates/deployment-api.yaml          | 4 ++++
 heat/templates/deployment-cfn.yaml          | 4 ++++
 horizon/templates/deployment.yaml           | 8 ++++++++
 keystone/templates/deployment-api.yaml      | 8 ++++++++
 nova/templates/deployment-api-metadata.yaml | 4 ++++
 nova/templates/deployment-api-osapi.yaml    | 4 ++++
 nova/templates/deployment-placement.yaml    | 5 +++++
 9 files changed, 45 insertions(+)

diff --git a/glance/templates/deployment-api.yaml b/glance/templates/deployment-api.yaml
index 31316c70aa..0bdc972034 100644
--- a/glance/templates/deployment-api.yaml
+++ b/glance/templates/deployment-api.yaml
@@ -109,6 +109,10 @@ spec:
           readinessProbe:
             tcpSocket:
               port: {{ tuple "image" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+          livenessProbe:
+            tcpSocket:
+              port: {{ tuple "image" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+            initialDelaySeconds: 30
           volumeMounts:
             - name: etcglance
               mountPath: /etc/glance
diff --git a/glance/templates/deployment-registry.yaml b/glance/templates/deployment-registry.yaml
index cf296e7bf9..54ef7c77d1 100644
--- a/glance/templates/deployment-registry.yaml
+++ b/glance/templates/deployment-registry.yaml
@@ -74,6 +74,10 @@ spec:
           readinessProbe:
             tcpSocket:
               port: {{ tuple "image_registry" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+          livenessProbe:
+            tcpSocket:
+              port: {{ tuple "image_registry" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+            initialDelaySeconds: 30
           volumeMounts:
             - name: etcglance
               mountPath: /etc/glance
diff --git a/heat/templates/deployment-api.yaml b/heat/templates/deployment-api.yaml
index e4799b2ac5..1339711c8e 100644
--- a/heat/templates/deployment-api.yaml
+++ b/heat/templates/deployment-api.yaml
@@ -74,6 +74,10 @@ spec:
           readinessProbe:
             tcpSocket:
               port: {{ tuple "orchestration" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+          livenessProbe:
+            tcpSocket:
+              port: {{ tuple "orchestration" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+            initialDelaySeconds: 30
           volumeMounts:
             - name: pod-etc-heat
               mountPath: /etc/heat
diff --git a/heat/templates/deployment-cfn.yaml b/heat/templates/deployment-cfn.yaml
index 81b165a8dd..4f5d083f71 100644
--- a/heat/templates/deployment-cfn.yaml
+++ b/heat/templates/deployment-cfn.yaml
@@ -74,6 +74,10 @@ spec:
           readinessProbe:
             tcpSocket:
               port: {{ tuple "cloudformation" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+          livenessProbe:
+            tcpSocket:
+              port: {{ tuple "cloudformation" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+            initialDelaySeconds: 30
           volumeMounts:
             - name: pod-etc-heat
               mountPath: /etc/heat
diff --git a/horizon/templates/deployment.yaml b/horizon/templates/deployment.yaml
index fe6b8da2bc..ebbf8153a2 100644
--- a/horizon/templates/deployment.yaml
+++ b/horizon/templates/deployment.yaml
@@ -78,6 +78,14 @@ spec:
               port: {{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
             initialDelaySeconds: 15
             periodSeconds: 10
+          livenessProbe:
+            httpGet:
+              scheme: HTTP
+              path: /
+              port: {{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+            initialDelaySeconds: 180
+            periodSeconds: 60
+            timeoutSeconds: 5
           volumeMounts:
             - name: static-horizon
               mountPath: /var/www/html/
diff --git a/keystone/templates/deployment-api.yaml b/keystone/templates/deployment-api.yaml
index c985cad132..bcec158efb 100644
--- a/keystone/templates/deployment-api.yaml
+++ b/keystone/templates/deployment-api.yaml
@@ -79,6 +79,14 @@ spec:
               port: {{ $portInt }}
             initialDelaySeconds: 15
             periodSeconds: 10
+          livenessProbe:
+            httpGet:
+              scheme: HTTP
+              path: /
+              port: {{ $portInt }}
+            initialDelaySeconds: 50
+            periodSeconds: 20
+            timeoutSeconds: 5
           volumeMounts:
           - name: etckeystone
             mountPath: /etc/keystone
diff --git a/nova/templates/deployment-api-metadata.yaml b/nova/templates/deployment-api-metadata.yaml
index dfc994741c..b58fbde68f 100644
--- a/nova/templates/deployment-api-metadata.yaml
+++ b/nova/templates/deployment-api-metadata.yaml
@@ -91,6 +91,10 @@ spec:
           readinessProbe:
             tcpSocket:
               port: {{ .Values.network.metadata.port }}
+          livenessProbe:
+            tcpSocket:
+              port: {{ .Values.network.metadata.port }}
+            initialDelaySeconds: 30
           volumeMounts:
             - name: nova-bin
               mountPath: /tmp/nova-api-metadata.sh
diff --git a/nova/templates/deployment-api-osapi.yaml b/nova/templates/deployment-api-osapi.yaml
index f0aa8059f5..46ce6af17e 100644
--- a/nova/templates/deployment-api-osapi.yaml
+++ b/nova/templates/deployment-api-osapi.yaml
@@ -74,6 +74,10 @@ spec:
           readinessProbe:
             tcpSocket:
               port: {{ tuple "compute" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+          livenessProbe:
+            tcpSocket:
+              port: {{ tuple "compute" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+            initialDelaySeconds: 30
           volumeMounts:
             - name: nova-bin
               mountPath: /tmp/nova-api.sh
diff --git a/nova/templates/deployment-placement.yaml b/nova/templates/deployment-placement.yaml
index db62d75422..1466fc3876 100644
--- a/nova/templates/deployment-placement.yaml
+++ b/nova/templates/deployment-placement.yaml
@@ -75,6 +75,11 @@ spec:
               port: {{ tuple "placement" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
             initialDelaySeconds: 15
             periodSeconds: 10
+          livenessProbe:
+            tcpSocket:
+              port: {{ tuple "placement" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
+            initialDelaySeconds: 50
+            periodSeconds: 10
           volumeMounts:
             - name: wsgi-nova
               mountPath: /var/www/cgi-bin/nova