From 1137c871c205c9b8cfadec4d48c87d9def2982f0 Mon Sep 17 00:00:00 2001 From: Gabriel Mainberger Date: Fri, 15 Jul 2022 10:03:50 +0200 Subject: [PATCH] Fix variable database.external.host not passed to the helm chart values The helm chart value database hostname was hardcoded to match the internal builtin mode. This change reenables the external database hostname is properly passed to the keycloak statefulset. --- class/defaults.yml | 4 ++-- tests/external.yml | 2 ++ .../keycloakx/templates/statefulset.yaml | 6 +++--- .../keycloakx/templates/statefulset.yaml | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/class/defaults.yml b/class/defaults.yml index 74d1d894..79af072e 100644 --- a/class/defaults.yml +++ b/class/defaults.yml @@ -144,7 +144,7 @@ parameters: # Used when `provider=external` external: vendor: postgres - host: postgres.example.com + host: keycloak-postgresql # Default for database provider builtin. If external use the FQDN postgres.example.com. port: 5432 k8up: @@ -269,7 +269,7 @@ parameters: enabled: ${keycloak:monitoring:enabled} database: vendor: ${keycloak:database:external:vendor} - hostname: keycloak-postgresql + hostname: ${keycloak:database:external:host} port: ${keycloak:database:external:port} database: ${keycloak:database:database} username: ${keycloak:database:username} diff --git a/tests/external.yml b/tests/external.yml index e73c6d59..7f188e66 100644 --- a/tests/external.yml +++ b/tests/external.yml @@ -5,6 +5,8 @@ parameters: jdbcParams: sslmode=verify-ca&sslrootcert=/etc/ssl/certs/ca-bundle.crt tls: verification: verify + external: + host: postgres.example.com tls: provider: vault ingress: diff --git a/tests/golden/external/external/external/01_keycloak_helmchart/keycloakx/templates/statefulset.yaml b/tests/golden/external/external/external/01_keycloak_helmchart/keycloakx/templates/statefulset.yaml index 64676be7..4e947ec7 100644 --- a/tests/golden/external/external/external/01_keycloak_helmchart/keycloakx/templates/statefulset.yaml +++ b/tests/golden/external/external/external/01_keycloak_helmchart/keycloakx/templates/statefulset.yaml @@ -71,7 +71,7 @@ spec: - name: KC_DB_URL_DATABASE value: keycloak - name: KC_DB_URL_HOST - value: keycloak-postgresql + value: postgres.example.com - name: KC_DB_URL_PORT value: '5432' - name: KC_DB_USERNAME @@ -160,8 +160,8 @@ spec: - sh - -c - "echo 'Waiting for Database to become ready...'\n\nuntil printf \".\" &&\ - \ nc -z -w 2 keycloak-postgresql 5432; do\n sleep 2;\ndone;\n\necho 'Database\ - \ OK \u2713'\n" + \ nc -z -w 2 postgres.example.com 5432; do\n sleep 2;\ndone;\n\necho\ + \ 'Database OK \u2713'\n" image: docker.io/busybox:1.32 imagePullPolicy: IfNotPresent name: dbchecker diff --git a/tests/golden/openshift/openshift/openshift/01_keycloak_helmchart/keycloakx/templates/statefulset.yaml b/tests/golden/openshift/openshift/openshift/01_keycloak_helmchart/keycloakx/templates/statefulset.yaml index aff0ec0d..7042b2f6 100644 --- a/tests/golden/openshift/openshift/openshift/01_keycloak_helmchart/keycloakx/templates/statefulset.yaml +++ b/tests/golden/openshift/openshift/openshift/01_keycloak_helmchart/keycloakx/templates/statefulset.yaml @@ -71,7 +71,7 @@ spec: - name: KC_DB_URL_DATABASE value: keycloak_dev - name: KC_DB_URL_HOST - value: keycloak-postgresql + value: maxscale-masteronly - name: KC_DB_URL_PORT value: '3306' - name: KC_DB_USERNAME @@ -167,7 +167,7 @@ spec: - sh - -c - "echo 'Waiting for Database to become ready...'\n\nuntil printf \".\" &&\ - \ nc -z -w 2 keycloak-postgresql 3306; do\n sleep 2;\ndone;\n\necho 'Database\ + \ nc -z -w 2 maxscale-masteronly 3306; do\n sleep 2;\ndone;\n\necho 'Database\ \ OK \u2713'\n" image: docker.io/busybox:1.32 imagePullPolicy: IfNotPresent