From 5513b3b2919c99ad25b7451853bbae5be72354c1 Mon Sep 17 00:00:00 2001 From: Pete Savage Date: Tue, 28 Nov 2023 11:44:09 +0000 Subject: [PATCH] Upgrade Keycloak Keycloak has been upgraded elsewhere and we need to respond * Updates the default Keycloak image * Changes the database environment variable to be dev-mem based * Changes the env var for initial admin credentials * Changes the mount path for the initial realm import --- .../cloud.redhat.com/providers/utils/utils.go | 2 +- .../providers/web/resources_keycloak.go | 24 +++++++++++-------- .../test-ephemeral-gateway/01-assert.yaml | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/controllers/cloud.redhat.com/providers/utils/utils.go b/controllers/cloud.redhat.com/providers/utils/utils.go index 27d59a4dd..3f8fc5bf1 100644 --- a/controllers/cloud.redhat.com/providers/utils/utils.go +++ b/controllers/cloud.redhat.com/providers/utils/utils.go @@ -25,7 +25,7 @@ var DefaultImageCaddySideCar = "quay.io/cloudservices/crc-caddy-plugin:a988cd2" var DefaultImageCaddyGateway = DefaultImageCaddySideCar var DefaultImageMBOP = "quay.io/cloudservices/mbop:959d00d" var DefaultImageMocktitlements = "quay.io/cloudservices/mocktitlements:e24820c" -var DefaultKeyCloakVersion = "15.0.2" +var DefaultKeyCloakVersion = "23.0.0" var DefaultImageKeyCloak = fmt.Sprintf("quay.io/keycloak/keycloak:%s", DefaultKeyCloakVersion) // MakeLocalDB populates the given deployment object with the local DB struct. diff --git a/controllers/cloud.redhat.com/providers/web/resources_keycloak.go b/controllers/cloud.redhat.com/providers/web/resources_keycloak.go index 18e9708c2..153673f5c 100644 --- a/controllers/cloud.redhat.com/providers/web/resources_keycloak.go +++ b/controllers/cloud.redhat.com/providers/web/resources_keycloak.go @@ -140,15 +140,15 @@ func makeKeycloak(o obj.ClowdObject, objMap providers.ObjectMap, _ bool, nodePor envVars := []core.EnvVar{ { - Name: "DB_VENDOR", - Value: "h2", + Name: "KC_DB", + Value: "dev-mem", }, { Name: "PROXY_ADDRESS_FORWARDING", Value: "true", }, { - Name: "KEYCLOAK_USER", + Name: "KEYCLOAK_ADMIN", ValueFrom: &core.EnvVarSource{ SecretKeyRef: &core.SecretKeySelector{ LocalObjectReference: core.LocalObjectReference{ @@ -159,7 +159,7 @@ func makeKeycloak(o obj.ClowdObject, objMap providers.ObjectMap, _ bool, nodePor }, }, { - Name: "KEYCLOAK_PASSWORD", + Name: "KEYCLOAK_ADMIN_PASSWORD", ValueFrom: &core.EnvVarSource{ SecretKeyRef: &core.SecretKeySelector{ LocalObjectReference: core.LocalObjectReference{ @@ -194,7 +194,7 @@ func makeKeycloak(o obj.ClowdObject, objMap providers.ObjectMap, _ bool, nodePor livenessProbe := core.Probe{ ProbeHandler: probeHandler, - InitialDelaySeconds: 10, + InitialDelaySeconds: 30, TimeoutSeconds: 2, PeriodSeconds: 10, SuccessThreshold: 1, @@ -202,7 +202,7 @@ func makeKeycloak(o obj.ClowdObject, objMap providers.ObjectMap, _ bool, nodePor } readinessProbe := core.Probe{ ProbeHandler: probeHandler, - InitialDelaySeconds: 20, + InitialDelaySeconds: 30, TimeoutSeconds: 2, PeriodSeconds: 10, SuccessThreshold: 1, @@ -213,9 +213,13 @@ func makeKeycloak(o obj.ClowdObject, objMap providers.ObjectMap, _ bool, nodePor image := provutils.GetKeycloakImage(env) c := core.Container{ - Name: nn.Name, - Image: image, - Env: envVars, + Name: nn.Name, + Image: image, + Env: envVars, + Args: []string{ + "start-dev", + "--import-realm", + }, Ports: ports, LivenessProbe: &livenessProbe, ReadinessProbe: &readinessProbe, @@ -235,7 +239,7 @@ func makeKeycloak(o obj.ClowdObject, objMap providers.ObjectMap, _ bool, nodePor VolumeMounts: []core.VolumeMount{ { Name: "realm-import", - MountPath: "/json", + MountPath: "/opt/keycloak/data/import/", }, }, } diff --git a/tests/kuttl/test-ephemeral-gateway/01-assert.yaml b/tests/kuttl/test-ephemeral-gateway/01-assert.yaml index 9176bc741..ee0e050ab 100644 --- a/tests/kuttl/test-ephemeral-gateway/01-assert.yaml +++ b/tests/kuttl/test-ephemeral-gateway/01-assert.yaml @@ -51,7 +51,7 @@ spec: template: spec: containers: - - image: quay.io/keycloak/keycloak:15.0.2 + - image: quay.io/keycloak/keycloak:23.0.0 --- apiVersion: apps/v1 kind: Deployment