From ab294a8e86bfcaeee7b61b8c5ead5f66ed7647f6 Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Mon, 26 Sep 2022 02:18:52 +0200
Subject: [PATCH] fix(keycloak): Add startup probe to catch slow startup

When using infinispan the app startup is a bit slower. As a result,
it'll might cause a termination of the keycloak instance before it's
fully in sync and therefore breaks HA. This patch introduces a startup
probe that resolves this issue by waiting for a successful startup
before the livenessprobe kicks in and might terminates the pod at any
point when it's actually failing again.

References:
https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-startup-probes
---
 charts/keycloak/Chart.yaml                |  2 +-
 charts/keycloak/README.md                 |  2 +-
 charts/keycloak/templates/deployment.yaml | 10 ++++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/charts/keycloak/Chart.yaml b/charts/keycloak/Chart.yaml
index 4196d3f57..75d8da2b0 100644
--- a/charts/keycloak/Chart.yaml
+++ b/charts/keycloak/Chart.yaml
@@ -7,5 +7,5 @@ icon: https://www.keycloak.org/resources/images/keycloak_icon_512px.svg
 sources:
   - https://git.shivering-isles.com/shivering-isles/infrastructure-gitops
   - https://github.com/keycloak/keycloak
-version: 0.4.1
+version: 0.4.2
 appVersion: "19.0.2"
diff --git a/charts/keycloak/README.md b/charts/keycloak/README.md
index c79ace568..4924fec7f 100644
--- a/charts/keycloak/README.md
+++ b/charts/keycloak/README.md
@@ -1,6 +1,6 @@
 # keycloak
 
-![Version: 0.4.1](https://img.shields.io/badge/Version-0.4.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 19.0.2](https://img.shields.io/badge/AppVersion-19.0.2-informational?style=flat-square)
+![Version: 0.4.2](https://img.shields.io/badge/Version-0.4.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 19.0.2](https://img.shields.io/badge/AppVersion-19.0.2-informational?style=flat-square)
 
 (Alpha) A Helm chart for Keycloak on Kubernetes
 
diff --git a/charts/keycloak/templates/deployment.yaml b/charts/keycloak/templates/deployment.yaml
index f6f4702f8..a06209c31 100644
--- a/charts/keycloak/templates/deployment.yaml
+++ b/charts/keycloak/templates/deployment.yaml
@@ -92,10 +92,20 @@ spec:
             httpGet:
               path: /health/live
               port: http
+            failureThreshold: 3
+            periodSeconds: 10
           readinessProbe:
             httpGet:
               path: /health/ready
               port: http
+            failureThreshold: 3
+            periodSeconds: 10
+          startupProbe:
+            httpGet:
+              path: /health/live
+              port: http
+            failureThreshold: 30
+            periodSeconds: 10
           resources:
             {{- toYaml .Values.resources | nindent 12 }}
       {{- with .Values.nodeSelector }}
-- 
GitLab