From 957fc7c2092c7574a0a931012a0ec1cf5bb66429 Mon Sep 17 00:00:00 2001 From: Teresa Ho Date: Tue, 30 Jun 2020 09:32:39 -0400 Subject: [PATCH] Fix liveness probe in oidc client The liveness probe was not setup correctly causing probe warnings. This update added the handling for the readiness and liveness probes. The probe parameters are also setup to be configurable in the helm charts. Partial-bug: 1877172 Change-Id: Ibe2d760897e761d361c3d4fe8c1ce41b33609d54 Signed-off-by: Teresa Ho --- .../oidc-client/templates/deployment.yaml | 16 ++++++++++++---- .../helm-charts/oidc-client/values.yaml | 14 ++++++++++++++ stx-oidc-client/centos/docker/main.go | 4 ++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/stx-oidc-auth-helm/stx-oidc-auth-helm/helm-charts/oidc-client/templates/deployment.yaml b/stx-oidc-auth-helm/stx-oidc-auth-helm/helm-charts/oidc-client/templates/deployment.yaml index 38dd335..a15896a 100644 --- a/stx-oidc-auth-helm/stx-oidc-auth-helm/helm-charts/oidc-client/templates/deployment.yaml +++ b/stx-oidc-auth-helm/stx-oidc-auth-helm/helm-charts/oidc-client/templates/deployment.yaml @@ -40,14 +40,22 @@ spec: protocol: TCP livenessProbe: httpGet: - path: / - port: http + path: {{ .Values.livenessProbe.httpPath }} + port: 5555 scheme: HTTPS + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} readinessProbe: httpGet: - path: / - port: http + path: {{ .Values.readinessProbe.httpPath }} + port: 5555 scheme: HTTPS + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} resources: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: diff --git a/stx-oidc-auth-helm/stx-oidc-auth-helm/helm-charts/oidc-client/values.yaml b/stx-oidc-auth-helm/stx-oidc-auth-helm/helm-charts/oidc-client/values.yaml index 53f2f0c..e96899e 100644 --- a/stx-oidc-auth-helm/stx-oidc-auth-helm/helm-charts/oidc-client/values.yaml +++ b/stx-oidc-auth-helm/stx-oidc-auth-helm/helm-charts/oidc-client/values.yaml @@ -39,6 +39,20 @@ ingress: paths: [] tls: [] +livenessProbe: + initialDelaySeconds: 1 + failureThreshold: 1 + httpPath: "/healthz" + periodSeconds: 10 + timeoutSeconds: 1 + +readinessProbe: + initialDelaySeconds: 1 + failureThreshold: 1 + httpPath: "/healthz" + periodSeconds: 10 + timeoutSeconds: 1 + resources: {} nodeSelector: {} diff --git a/stx-oidc-client/centos/docker/main.go b/stx-oidc-client/centos/docker/main.go index ca36561..8f7bc45 100644 --- a/stx-oidc-client/centos/docker/main.go +++ b/stx-oidc-client/centos/docker/main.go @@ -177,6 +177,10 @@ func start_app(config Config) { http.HandleFunc("/", config.a.handleLogin) http.HandleFunc(u.Path, config.a.handleCallback) + http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(200) + w.Write([]byte("ok")) + }) switch listenURL.Scheme { case "http":