From 1c6b2f130b4ebdd9f5350ea7db2f9e9345c53f46 Mon Sep 17 00:00:00 2001 From: Nico Koprowski Date: Fri, 12 May 2023 13:41:11 +0200 Subject: [PATCH 1/2] feat(helm): add postgres dependency to Gate chart also increase alpha versions of the Gate Chart.yaml --- charts/gate/CHANGELOG.md | 4 ++++ charts/gate/Chart.yaml | 8 +++++++- charts/gate/templates/_helpers.tpl | 17 +++++++++++++++++ charts/gate/templates/configMap.yaml | 2 ++ charts/gate/values.yaml | 17 ++++++++++++++--- 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/charts/gate/CHANGELOG.md b/charts/gate/CHANGELOG.md index 6d506d0eb..526352c7d 100644 --- a/charts/gate/CHANGELOG.md +++ b/charts/gate/CHANGELOG.md @@ -11,6 +11,10 @@ The format is based on Keep a Changelog (https://keepachangelog.com/en/1.0.0/), - increase to app version 4.0.0 - add missing license headers to ingress templates +### Added + +- postgres chart dependency for persistence + ## [3.3.0] - 2023-03-17 ### Changed diff --git a/charts/gate/Chart.yaml b/charts/gate/Chart.yaml index 2de4b4e49..80a2e750e 100644 --- a/charts/gate/Chart.yaml +++ b/charts/gate/Chart.yaml @@ -22,10 +22,16 @@ apiVersion: v2 type: application name: bpdm-gate appVersion: "4.0.0-alpha.1" -version: 4.0.0-alpha.3 +version: 4.0.0-alpha.4 description: A Helm chart for deploying the BPDM gate service home: https://eclipse-tractusx.github.io/docs/kits/Business%20Partner%20Kit/Adoption%20View sources: - https://github.com/eclipse-tractusx/bpdm +dependencies: + - name: postgresql + version: 11.9.1 + repository: https://charts.bitnami.com/bitnami + alias: postgres + condition: postgres.enabled maintainers: - name: Nico Koprowski diff --git a/charts/gate/templates/_helpers.tpl b/charts/gate/templates/_helpers.tpl index bf04fd257..d57b847a8 100644 --- a/charts/gate/templates/_helpers.tpl +++ b/charts/gate/templates/_helpers.tpl @@ -75,3 +75,20 @@ Create name of application secret {{- define "bpdm.applicationSecret.name" -}} {{- printf "%s-application" (include "bpdm.fullname" .) }} {{- end }} + +{/* +Determine postgres service/host name to connect to +*/}} +{{- define "bpdm.postgresDependency" -}} + {{- include "includeWithPostgresContext" (list $ "postgresql.primary.fullname") }} +{{- end }}} + +{{/* +Invoke include on given definition with postgresql dependency context +Usage: include "includeWithPostgresContext" (list $ "your_include_function_here") +*/}} +{{- define "includeWithPostgresContext" -}} +{{- $ := index . 0 }} +{{- $function := index . 1 }} +{{- include $function (dict "Values" $.Values.postgres "Chart" (dict "Name" "postgres") "Release" $.Release) }} +{{- end }} \ No newline at end of file diff --git a/charts/gate/templates/configMap.yaml b/charts/gate/templates/configMap.yaml index 28f5a0f2b..d10f52fbb 100644 --- a/charts/gate/templates/configMap.yaml +++ b/charts/gate/templates/configMap.yaml @@ -29,6 +29,8 @@ data: # Place for putting standard deployment configuration # which can be overwritten by external.yml bpdm: + datasource: + host: {{ include "bpdm.postgresDependency" . }} pool: base-url: http://pool-bpdm:8080/api/catena external.yml: |- diff --git a/charts/gate/values.yaml b/charts/gate/values.yaml index 668a72a1d..7c6762ad1 100644 --- a/charts/gate/values.yaml +++ b/charts/gate/values.yaml @@ -121,6 +121,17 @@ applicationConfig: # Used to overwrite the secret property values of the application configuration applicationSecrets: -# bpdm: -# saas: -# api-key: ... + spring: + datasource: + # overwrite for security reasons + password: bpdm + +postgres: + enabled: true + auth: + database: bpdm + # overwrite for security reasons + postgresPassword: bpdm + username: bpdm + # overwrite for security reasons + password: bpdm \ No newline at end of file From e6954b77c5bada15e011bc6072dbe91afcbd4af7 Mon Sep 17 00:00:00 2001 From: Nico Koprowski Date: Fri, 12 May 2023 13:56:41 +0200 Subject: [PATCH 2/2] feat(helm): add postgres dependency to Gate chart also increase alpha versions of the Gate Chart.yaml --- charts/gate/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gate/values.yaml b/charts/gate/values.yaml index 7c6762ad1..729e88857 100644 --- a/charts/gate/values.yaml +++ b/charts/gate/values.yaml @@ -134,4 +134,4 @@ postgres: postgresPassword: bpdm username: bpdm # overwrite for security reasons - password: bpdm \ No newline at end of file + password: bpdm