From c27ed6d0dacc95aeac32555f7589fc222d0ffd30 Mon Sep 17 00:00:00 2001
From: Marco Amoia <marco.amoia@consultant.aruba.it>
Date: Fri, 18 Oct 2024 14:25:26 +0200
Subject: [PATCH] fix helm chart

---
 charts/README.md                         | 9 +++++++++
 charts/templates/configmap.yaml          | 3 +++
 charts/templates/service.yaml            | 4 ++--
 charts/values.yaml                       | 5 +++++
 pipeline.variables.sh                    | 2 +-
 src/main/resources/application-local.yml | 3 +++
 src/main/resources/application.yml       | 4 ++--
 7 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/charts/README.md b/charts/README.md
index 783f31ed..1b0113e1 100644
--- a/charts/README.md
+++ b/charts/README.md
@@ -35,6 +35,10 @@ The environment variables listed below are used to define the connection details
     - This value is generated using the `microservices.backend.url` Helm template and points to the `/auth` endpoint of the Keycloak service.
 - `KEYCLOAK_APP_REALM`: The realm to be used for the application within Keycloak.
     - Value is derived from the `global.profile` specified in the Helm values.
+- `KEYCLOAK_MASTER_USER`: The username to be used for the master realm in keycloak.
+  - Value is derived from the `keycloak.master.user` specified in the Helm values.
+- `KEYCLOAK_MASTER_PASSWORD`: The password to be used for the master realm in keycloak.
+  - Value is derived from the `keycloak.master.password` specified in the Helm values.
 
 ### Client Authority Configuration
 
@@ -71,4 +75,9 @@ redis:
   port: "6379"
   username: "default"
   password: "admin"
+
+keycloak:
+  master:
+    user: "user"
+    password: "admin"
 ```
diff --git a/charts/templates/configmap.yaml b/charts/templates/configmap.yaml
index ec3a9ef3..7a7c1cf7 100644
--- a/charts/templates/configmap.yaml
+++ b/charts/templates/configmap.yaml
@@ -14,5 +14,8 @@ data:
 
   KEYCLOAK_URL: "{{- include "microservices.backend.url" . }}/auth"
   KEYCLOAK_APP_REALM: "{{ .Values.global.profile }}"
+  KEYCLOAK_MASTER_USER: "{{ .Values.keycloak.master.user }}"
+  KEYCLOAK_MASTER_PASSWORD: "{{ .Values.keycloak.master.password }}"
+
   CLIENT_AUTHORITY_URL: "{{- include "tls.gateway.url" . }}"
   CLIENT_CERTIFICATE_PASSWORD: "{{ .Values.global.keystore.password }}"
\ No newline at end of file
diff --git a/charts/templates/service.yaml b/charts/templates/service.yaml
index cebc5859..61891104 100644
--- a/charts/templates/service.yaml
+++ b/charts/templates/service.yaml
@@ -5,9 +5,9 @@ metadata:
   labels:
     {{- include "microservices.labels" . | nindent 4 }}
 spec:
-  type: {{ .Values.services.type }}
+  type: {{ .Values.service.type }}
   ports:
-    - port: {{ .Values.services.port }}
+    - port: {{ .Values.service.port }}
       targetPort: http
       protocol: TCP
       name: http
diff --git a/charts/values.yaml b/charts/values.yaml
index 14bb699b..31121ea3 100644
--- a/charts/values.yaml
+++ b/charts/values.yaml
@@ -118,3 +118,8 @@ redis:
   port: "6379"
   username: "default"
   password: "admin"
+
+keycloak:
+  master:
+    user: "user"
+    password: "admin"
\ No newline at end of file
diff --git a/pipeline.variables.sh b/pipeline.variables.sh
index 215a3b66..5ce228ea 100644
--- a/pipeline.variables.sh
+++ b/pipeline.variables.sh
@@ -1 +1 @@
-PROJECT_VERSION_NUMBER="0.5.0"
\ No newline at end of file
+PROJECT_VERSION_NUMBER="0.5.1"
\ No newline at end of file
diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml
index 06534429..d199fa25 100644
--- a/src/main/resources/application-local.yml
+++ b/src/main/resources/application-local.yml
@@ -19,6 +19,9 @@ logging:
 
 keycloak:
   url: http://localhost:9090
+  master:
+    user: user
+    password: admin
   app:
     realm: participant
     client-id: frontend-cli
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 2fccfde5..a6239dd5 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -34,8 +34,8 @@ keycloak:
   master:
     realm: master
     client-id: admin-cli
-    user: admin
-    password: admin
+    user: [KEYCLOAK_USER]
+    password: [KEYCLOAK_PASSWORD]
   app:
     realm: [KEYCLOAK_APP_REALM]
     client-id: frontend-cli
-- 
GitLab