From 449f251b7d95cf0ad4cd68cc2b4a5c6d20f156ea Mon Sep 17 00:00:00 2001 From: jparkzz Date: Wed, 25 Jun 2025 16:28:02 +0900 Subject: [PATCH 01/10] feat: Add relational-jdbc for persistence --- helm/polaris/templates/configmap.yaml | 5 +++++ helm/polaris/templates/deployment.yaml | 11 ++++++++++- helm/polaris/values.yaml | 11 ++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/helm/polaris/templates/configmap.yaml b/helm/polaris/templates/configmap.yaml index 6d12fbd7e1..82443fdfec 100644 --- a/helm/polaris/templates/configmap.yaml +++ b/helm/polaris/templates/configmap.yaml @@ -53,6 +53,11 @@ data: {{- $_ = set $map "polaris.persistence.eclipselink.persistence-unit" .Values.persistence.eclipseLink.persistenceUnit -}} {{- $_ = set $map "polaris.persistence.eclipselink.configuration-file" (printf "%s/persistence.xml" .Values.image.configDir ) -}} {{- end -}} + {{- if eq .Values.persistence.type "relational-jdbc" -}} + {{- if .Values.persistence.relationalJdbc.dbKind -}} + {{- $_ = set $map "quarkus.datasource.db-kind" .Values.persistence.relationalJdbc.dbKind -}} + {{- end -}} + {{- end -}} {{- /* File IO */ -}} {{- $_ = set $map "polaris.file-io.type" .Values.fileIo.type -}} diff --git a/helm/polaris/templates/deployment.yaml b/helm/polaris/templates/deployment.yaml index a444cc5076..e54e4d2f7f 100644 --- a/helm/polaris/templates/deployment.yaml +++ b/helm/polaris/templates/deployment.yaml @@ -72,11 +72,20 @@ spec: {{- end }} image: "{{ tpl .Values.image.repository . }}:{{ tpl .Values.image.tag . | default .Chart.Version }}" imagePullPolicy: {{ tpl .Values.image.pullPolicy . }} - {{ if or .Values.storage.secret.name .Values.extraEnv -}} + {{ if or .Values.storage.secret.name .Values.persistence.relationalJdbc.secret.name .Values.extraEnv -}} env: {{- include "polaris.secretToEnv" (list .Values.storage.secret "awsAccessKeyId" "polaris.storage.aws.access-key") | indent 12 -}} {{- include "polaris.secretToEnv" (list .Values.storage.secret "awsSecretAccessKey" "polaris.storage.aws.secret-key") | indent 12 -}} {{- include "polaris.secretToEnv" (list .Values.storage.secret "gcpToken" "polaris.storage.gcp.token") | indent 12 -}} + {{- if and ( eq .Values.persistence.type "relational-jdbc" ) .Values.persistence.relationalJdbc.secret.name }} + {{- range $key := list "username" "password" "jdbc_url" }} + - name: QUARKUS_DATASOURCE_{{ $key | upper }} + valueFrom: + secretKeyRef: + name: {{ $.Values.persistence.relationalJdbc.secret.name }} + key: {{ $key }} + {{- end }} + {{- end }} {{- if .Values.extraEnv -}} {{- tpl (toYaml .Values.extraEnv) . | nindent 12 -}} {{- end -}} diff --git a/helm/polaris/values.yaml b/helm/polaris/values.yaml index 5cf964f20c..baf91d6fb1 100644 --- a/helm/polaris/values.yaml +++ b/helm/polaris/values.yaml @@ -522,7 +522,16 @@ features: # -- Polaris persistence configuration. persistence: # -- The type of persistence to use. Two built-in types are supported: in-memory and eclipse-link. - type: eclipse-link # in-memory + type: ~ # in-memory + # -- The configuration for the relational-jdbc persistence manager. + relationalJdbc: + # -- The type of database to use. Valid values are: h2, postgres. + dbKind: ~ + + # -- The secret name to pull the database connection properties from. + secret: + name: ~ + # -- The configuration for the eclipse-link persistence manager. eclipseLink: # -- The secret name to pull persistence.xml from. From cdb523bd2478f746261f931575edd6c9767ac4eb Mon Sep 17 00:00:00 2001 From: jparkzz Date: Wed, 25 Jun 2025 16:41:36 +0900 Subject: [PATCH 02/10] ci: Testing jdbc persistence --- helm/polaris/ci/fixtures/persistence.yaml | 34 ++--------------------- helm/polaris/ci/persistence-values.yaml | 4 +-- helm/polaris/tests/configmap_test.yaml | 6 ++++ helm/polaris/tests/deployment_test.yaml | 29 +++++++++++++++++++ 4 files changed, 40 insertions(+), 33 deletions(-) diff --git a/helm/polaris/ci/fixtures/persistence.yaml b/helm/polaris/ci/fixtures/persistence.yaml index 9b6e6cab94..8e143f9916 100644 --- a/helm/polaris/ci/fixtures/persistence.yaml +++ b/helm/polaris/ci/fixtures/persistence.yaml @@ -23,34 +23,6 @@ metadata: name: polaris-persistence type: Opaque stringData: - persistence.xml: |- - - - org.eclipse.persistence.jpa.PersistenceProvider - org.apache.polaris.extension.persistence.impl.eclipselink.models.ModelEntity - org.apache.polaris.extension.persistence.impl.eclipselink.models.ModelEntityActive - org.apache.polaris.extension.persistence.impl.eclipselink.models.ModelEntityChangeTracking - org.apache.polaris.extension.persistence.impl.eclipselink.models.ModelEntityDropped - org.apache.polaris.extension.persistence.impl.eclipselink.models.ModelGrantRecord - org.apache.polaris.extension.persistence.impl.eclipselink.models.ModelPrincipalSecrets - org.apache.polaris.extension.persistence.impl.eclipselink.models.ModelSequenceId - NONE - - - - - - - - - - - - - - - - + username: "postgres" + password: "postgres" + jdbc_url: "jdbc:postgresql://postgres:5432/POLARIS" diff --git a/helm/polaris/ci/persistence-values.yaml b/helm/polaris/ci/persistence-values.yaml index 3d83874399..9807217ba9 100644 --- a/helm/polaris/ci/persistence-values.yaml +++ b/helm/polaris/ci/persistence-values.yaml @@ -33,7 +33,7 @@ logging: size: 50Mi persistence: - type: eclipse-link - eclipseLink: + type: relational-jdbc + relationalJdbc: secret: name: polaris-persistence diff --git a/helm/polaris/tests/configmap_test.yaml b/helm/polaris/tests/configmap_test.yaml index 562adad220..875469dac5 100644 --- a/helm/polaris/tests/configmap_test.yaml +++ b/helm/polaris/tests/configmap_test.yaml @@ -110,6 +110,12 @@ tests: - matchRegex: { path: 'data["application.properties"]', pattern: "polaris.persistence.eclipselink.persistence-unit=polaris" } - matchRegex: { path: 'data["application.properties"]', pattern: "polaris.persistence.eclipselink.configuration-file=/deployments/config/persistence.xml" } + - it: should configure relational-jdbc persistence + set: + persistence: { type: "relational-jdbc", relationalJdbc: { secret: { name: "polaris-persistence" } } } + asserts: + - matchRegex: { path: 'data["application.properties"]', pattern: "polaris.persistence.type=relational-jdbc" } + - it: should configure file-io set: fileIo.type: "custom" diff --git a/helm/polaris/tests/deployment_test.yaml b/helm/polaris/tests/deployment_test.yaml index 1d457adef5..e7f7401483 100644 --- a/helm/polaris/tests/deployment_test.yaml +++ b/helm/polaris/tests/deployment_test.yaml @@ -1020,6 +1020,35 @@ tests: - key: custom.xml path: persistence.xml + - it: should set relational-jdbc persistence environment variables + set: + persistence: { type: "relational-jdbc", relationalJdbc: { secret: { name: "polaris-persistence" } } } + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: QUARKUS_DATASOURCE_USERNAME + valueFrom: + secretKeyRef: + name: polaris-persistence + key: username + - contains: + path: spec.template.spec.containers[0].env + content: + name: QUARKUS_DATASOURCE_PASSWORD + valueFrom: + secretKeyRef: + name: polaris-persistence + key: password + - contains: + path: spec.template.spec.containers[0].env + content: + name: QUARKUS_DATASOURCE_JDBC_URL + valueFrom: + secretKeyRef: + name: polaris-persistence + key: jdbc_url + - it: should configure volume for file logging set: logging.file.enabled: true From 47fb4f2f6074d97d02075b89b85e3771648a49e3 Mon Sep 17 00:00:00 2001 From: jparkzz Date: Thu, 26 Jun 2025 12:42:45 +0900 Subject: [PATCH 03/10] style: Lint chart --- helm/polaris/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/polaris/values.yaml b/helm/polaris/values.yaml index baf91d6fb1..3cd188a06c 100644 --- a/helm/polaris/values.yaml +++ b/helm/polaris/values.yaml @@ -522,14 +522,14 @@ features: # -- Polaris persistence configuration. persistence: # -- The type of persistence to use. Two built-in types are supported: in-memory and eclipse-link. - type: ~ # in-memory + type: ~ # in-memory # -- The configuration for the relational-jdbc persistence manager. relationalJdbc: # -- The type of database to use. Valid values are: h2, postgres. dbKind: ~ - # -- The secret name to pull the database connection properties from. secret: + # -- The secret name to pull the database connection properties from. name: ~ # -- The configuration for the eclipse-link persistence manager. From 990cfe532e9138423e85100bb58a5f5bc23d340e Mon Sep 17 00:00:00 2001 From: Jiwon Park <22048252+jparkzz@users.noreply.github.com> Date: Fri, 27 Jun 2025 09:39:35 +0900 Subject: [PATCH 04/10] docs: Update comment Co-authored-by: Alexandre Dutra --- helm/polaris/values.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helm/polaris/values.yaml b/helm/polaris/values.yaml index 3cd188a06c..a80615cf72 100644 --- a/helm/polaris/values.yaml +++ b/helm/polaris/values.yaml @@ -521,7 +521,8 @@ features: # -- Polaris persistence configuration. persistence: - # -- The type of persistence to use. Two built-in types are supported: in-memory and eclipse-link. + # -- The type of persistence to use. Two built-in types are supported: in-memory and relational-jdbc. + # The eclipse-link type is also supported but is deprecated. type: ~ # in-memory # -- The configuration for the relational-jdbc persistence manager. relationalJdbc: From 093955c718bc88fbd7b51acdebb18c249009b18a Mon Sep 17 00:00:00 2001 From: Jiwon Park <22048252+jparkzz@users.noreply.github.com> Date: Fri, 27 Jun 2025 09:40:36 +0900 Subject: [PATCH 05/10] fix: Fix jdbc.url to camel case Co-authored-by: Alexandre Dutra --- helm/polaris/templates/deployment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/polaris/templates/deployment.yaml b/helm/polaris/templates/deployment.yaml index e54e4d2f7f..d6fec4c1e1 100644 --- a/helm/polaris/templates/deployment.yaml +++ b/helm/polaris/templates/deployment.yaml @@ -78,8 +78,8 @@ spec: {{- include "polaris.secretToEnv" (list .Values.storage.secret "awsSecretAccessKey" "polaris.storage.aws.secret-key") | indent 12 -}} {{- include "polaris.secretToEnv" (list .Values.storage.secret "gcpToken" "polaris.storage.gcp.token") | indent 12 -}} {{- if and ( eq .Values.persistence.type "relational-jdbc" ) .Values.persistence.relationalJdbc.secret.name }} - {{- range $key := list "username" "password" "jdbc_url" }} - - name: QUARKUS_DATASOURCE_{{ $key | upper }} + {{- range $key, $envVar := dict "username" "username" "password" "password" "jdbcUrl" "jdbc.url" }} + - name: quarkus.datasource.{{ $envVar }} valueFrom: secretKeyRef: name: {{ $.Values.persistence.relationalJdbc.secret.name }} From 75dfc4f54849a78745eb58e1915bd9a8e3fb7e1b Mon Sep 17 00:00:00 2001 From: jparkzz Date: Fri, 27 Jun 2025 10:51:57 +0900 Subject: [PATCH 06/10] ci: Fix test values for persistence --- helm/polaris/ci/fixtures/persistence.yaml | 2 +- helm/polaris/ci/persistence-values.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/helm/polaris/ci/fixtures/persistence.yaml b/helm/polaris/ci/fixtures/persistence.yaml index 8e143f9916..e1bcb29298 100644 --- a/helm/polaris/ci/fixtures/persistence.yaml +++ b/helm/polaris/ci/fixtures/persistence.yaml @@ -25,4 +25,4 @@ type: Opaque stringData: username: "postgres" password: "postgres" - jdbc_url: "jdbc:postgresql://postgres:5432/POLARIS" + jdbcUrl: "jdbc:postgresql://postgres:5432/POLARIS" diff --git a/helm/polaris/ci/persistence-values.yaml b/helm/polaris/ci/persistence-values.yaml index 9807217ba9..5f684d3500 100644 --- a/helm/polaris/ci/persistence-values.yaml +++ b/helm/polaris/ci/persistence-values.yaml @@ -35,5 +35,6 @@ logging: persistence: type: relational-jdbc relationalJdbc: + dbKind: postgres secret: name: polaris-persistence From b0b4d67304bedf684268e04c0cc5a61ce35b7c3d Mon Sep 17 00:00:00 2001 From: jparkzz Date: Fri, 27 Jun 2025 10:52:07 +0900 Subject: [PATCH 07/10] feat: Change default values for persistence --- helm/polaris/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/polaris/values.yaml b/helm/polaris/values.yaml index a80615cf72..45270bb92a 100644 --- a/helm/polaris/values.yaml +++ b/helm/polaris/values.yaml @@ -523,11 +523,11 @@ features: persistence: # -- The type of persistence to use. Two built-in types are supported: in-memory and relational-jdbc. # The eclipse-link type is also supported but is deprecated. - type: ~ # in-memory + type: in-memory # relational-jdbc # -- The configuration for the relational-jdbc persistence manager. relationalJdbc: # -- The type of database to use. Valid values are: h2, postgres. - dbKind: ~ + dbKind: postgres # h2 # -- The secret name to pull the database connection properties from. secret: # -- The secret name to pull the database connection properties from. From 8b10e5f5afb1fb53e33b5d7bdd65e43b6e1f4ddf Mon Sep 17 00:00:00 2001 From: jparkzz Date: Fri, 27 Jun 2025 10:55:25 +0900 Subject: [PATCH 08/10] style: Lint charts --- helm/polaris/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/polaris/values.yaml b/helm/polaris/values.yaml index 45270bb92a..28cc1bb025 100644 --- a/helm/polaris/values.yaml +++ b/helm/polaris/values.yaml @@ -523,11 +523,11 @@ features: persistence: # -- The type of persistence to use. Two built-in types are supported: in-memory and relational-jdbc. # The eclipse-link type is also supported but is deprecated. - type: in-memory # relational-jdbc + type: in-memory # relational-jdbc # -- The configuration for the relational-jdbc persistence manager. relationalJdbc: # -- The type of database to use. Valid values are: h2, postgres. - dbKind: postgres # h2 + dbKind: postgres # h2 # -- The secret name to pull the database connection properties from. secret: # -- The secret name to pull the database connection properties from. From c9e4bf46fdd87b9cc1f0c03b487a2ac8823f2349 Mon Sep 17 00:00:00 2001 From: jparkzz Date: Fri, 27 Jun 2025 17:35:56 +0900 Subject: [PATCH 09/10] fix: Fix env for quarkus to upper case --- helm/polaris/templates/deployment.yaml | 4 ++-- helm/polaris/tests/deployment_test.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/helm/polaris/templates/deployment.yaml b/helm/polaris/templates/deployment.yaml index d6fec4c1e1..e1abca1d1e 100644 --- a/helm/polaris/templates/deployment.yaml +++ b/helm/polaris/templates/deployment.yaml @@ -78,8 +78,8 @@ spec: {{- include "polaris.secretToEnv" (list .Values.storage.secret "awsSecretAccessKey" "polaris.storage.aws.secret-key") | indent 12 -}} {{- include "polaris.secretToEnv" (list .Values.storage.secret "gcpToken" "polaris.storage.gcp.token") | indent 12 -}} {{- if and ( eq .Values.persistence.type "relational-jdbc" ) .Values.persistence.relationalJdbc.secret.name }} - {{- range $key, $envVar := dict "username" "username" "password" "password" "jdbcUrl" "jdbc.url" }} - - name: quarkus.datasource.{{ $envVar }} + {{- range $key, $envVar := dict "username" "USERNAME" "password" "PASSWORD" "jdbcUrl" "JDBC_URL" }} + - name: QUARKUS_DATASOURCE_{{ $envVar }} valueFrom: secretKeyRef: name: {{ $.Values.persistence.relationalJdbc.secret.name }} diff --git a/helm/polaris/tests/deployment_test.yaml b/helm/polaris/tests/deployment_test.yaml index e7f7401483..e4760fa764 100644 --- a/helm/polaris/tests/deployment_test.yaml +++ b/helm/polaris/tests/deployment_test.yaml @@ -1022,7 +1022,7 @@ tests: - it: should set relational-jdbc persistence environment variables set: - persistence: { type: "relational-jdbc", relationalJdbc: { secret: { name: "polaris-persistence" } } } + persistence: { type: "relational-jdbc", dbKind: postgres, relationalJdbc: { secret: { name: "polaris-persistence" } } } asserts: - contains: path: spec.template.spec.containers[0].env @@ -1047,7 +1047,7 @@ tests: valueFrom: secretKeyRef: name: polaris-persistence - key: jdbc_url + key: jdbcUrl - it: should configure volume for file logging set: From 0cb8e8ee0accbb71631169893632c66b29f5e443 Mon Sep 17 00:00:00 2001 From: jparkzz Date: Sat, 28 Jun 2025 21:55:44 +0900 Subject: [PATCH 10/10] refactor: Change datasource variables to lowercase with dot --- helm/polaris/templates/deployment.yaml | 4 ++-- helm/polaris/tests/deployment_test.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/helm/polaris/templates/deployment.yaml b/helm/polaris/templates/deployment.yaml index e1abca1d1e..d6fec4c1e1 100644 --- a/helm/polaris/templates/deployment.yaml +++ b/helm/polaris/templates/deployment.yaml @@ -78,8 +78,8 @@ spec: {{- include "polaris.secretToEnv" (list .Values.storage.secret "awsSecretAccessKey" "polaris.storage.aws.secret-key") | indent 12 -}} {{- include "polaris.secretToEnv" (list .Values.storage.secret "gcpToken" "polaris.storage.gcp.token") | indent 12 -}} {{- if and ( eq .Values.persistence.type "relational-jdbc" ) .Values.persistence.relationalJdbc.secret.name }} - {{- range $key, $envVar := dict "username" "USERNAME" "password" "PASSWORD" "jdbcUrl" "JDBC_URL" }} - - name: QUARKUS_DATASOURCE_{{ $envVar }} + {{- range $key, $envVar := dict "username" "username" "password" "password" "jdbcUrl" "jdbc.url" }} + - name: quarkus.datasource.{{ $envVar }} valueFrom: secretKeyRef: name: {{ $.Values.persistence.relationalJdbc.secret.name }} diff --git a/helm/polaris/tests/deployment_test.yaml b/helm/polaris/tests/deployment_test.yaml index e4760fa764..00c5eb52cd 100644 --- a/helm/polaris/tests/deployment_test.yaml +++ b/helm/polaris/tests/deployment_test.yaml @@ -1027,7 +1027,7 @@ tests: - contains: path: spec.template.spec.containers[0].env content: - name: QUARKUS_DATASOURCE_USERNAME + name: quarkus.datasource.username valueFrom: secretKeyRef: name: polaris-persistence @@ -1035,7 +1035,7 @@ tests: - contains: path: spec.template.spec.containers[0].env content: - name: QUARKUS_DATASOURCE_PASSWORD + name: quarkus.datasource.password valueFrom: secretKeyRef: name: polaris-persistence @@ -1043,7 +1043,7 @@ tests: - contains: path: spec.template.spec.containers[0].env content: - name: QUARKUS_DATASOURCE_JDBC_URL + name: quarkus.datasource.jdbc.url valueFrom: secretKeyRef: name: polaris-persistence