From 2d3265cad21fd6ce8518b8d6deb4d677b68d0d70 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 25 Sep 2023 17:48:34 +0200 Subject: [PATCH] allow jdbc url starting with jdbc --- charts/alfresco-repository/Chart.yaml | 2 +- charts/alfresco-repository/README.md | 4 ++-- .../templates/_helpers-database.tpl | 2 +- .../templates/configmap-repository.yaml | 2 +- .../tests/configmap_test.yaml | 23 +++++-------------- charts/alfresco-repository/values.yaml | 2 +- 6 files changed, 12 insertions(+), 23 deletions(-) diff --git a/charts/alfresco-repository/Chart.yaml b/charts/alfresco-repository/Chart.yaml index e01e94b9..905d07d6 100644 --- a/charts/alfresco-repository/Chart.yaml +++ b/charts/alfresco-repository/Chart.yaml @@ -6,7 +6,7 @@ version: 0.1.0-alpha.9 appVersion: 23.1.0-A21 dependencies: - name: alfresco-common - version: 3.0.0-alpha.1 + version: 3.0.0-alpha.2 repository: https://alfresco.github.io/alfresco-helm-charts/ - name: postgresql version: 12.5.6 diff --git a/charts/alfresco-repository/README.md b/charts/alfresco-repository/README.md index 41a374b8..15e8b4ff 100644 --- a/charts/alfresco-repository/README.md +++ b/charts/alfresco-repository/README.md @@ -8,7 +8,7 @@ Alfresco content repository Helm chart | Repository | Name | Version | |------------|------|---------| -| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.0.0-alpha.1 | +| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.0.0-alpha.2 | | oci://registry-1.docker.io/bitnamicharts | postgresql | 12.5.6 | ## Configuring Alfresco subsystems @@ -105,7 +105,7 @@ environment: | configuration.db.existingSecret.keys.username | string | `"DATABASE_USERNAME"` | Key within the secret holding the database username | | configuration.db.existingSecret.name | string | `nil` | Name of a pre-existing secret containing database credentials | | configuration.db.password | string | `nil` | Password to authentication to the repository database | -| configuration.db.url | string | `nil` | JDBC url of the database WITHOUT the "jdbc:" prefix This is a mandatory parameter | +| configuration.db.url | string | `nil` | JDBC url of the database This is a mandatory parameter | | configuration.db.username | string | `nil` | Username to authentication to the repository database | | configuration.hz.port | int | `5701` | Hazelcast listener port Only change it if you use a custom image where the port has been changed from default | | configuration.messageBroker.existingConfigMap.keys.url | string | `"BROKER_URL"` | Key within the configmap holding the message broker URL. It MUST be a failover URL as per the spec below: https://activemq.apache.org/failover-transport-reference.html | diff --git a/charts/alfresco-repository/templates/_helpers-database.tpl b/charts/alfresco-repository/templates/_helpers-database.tpl index e33f865f..999b2a77 100644 --- a/charts/alfresco-repository/templates/_helpers-database.tpl +++ b/charts/alfresco-repository/templates/_helpers-database.tpl @@ -38,7 +38,7 @@ Usage: include "alfresco-repository.db.cm" (dict "url" "" "driver" "") */}} {{- define "alfresco-repository.db.cm" -}} - DATABASE_URL: {{ .url }} + DATABASE_URL: {{ hasPrefix "jdbc:" .url | ternary .url (print "jdbc:" .url) }} DATABASE_HOST: {{ template "alfresco-common.db.hostname" .url }} DATABASE_PORT: {{ include "alfresco-common.db.port" . | quote }} DATABASE_DRIVER: {{ template "alfresco-common.db.driver" . }} diff --git a/charts/alfresco-repository/templates/configmap-repository.yaml b/charts/alfresco-repository/templates/configmap-repository.yaml index af721032..d43fa024 100644 --- a/charts/alfresco-repository/templates/configmap-repository.yaml +++ b/charts/alfresco-repository/templates/configmap-repository.yaml @@ -10,7 +10,7 @@ data: CATALINA_OPTS: >- {{- with .Values.configuration }} -Ddeployment.method=HELM_CHART - -Ddb.url="jdbc:$DATABASE_URL" + -Ddb.url="$DATABASE_URL" -Ddb.username=${DATABASE_USERNAME} -Ddb.password=${DATABASE_PASSWORD} -Ddb.driver="$DATABASE_DRIVER" diff --git a/charts/alfresco-repository/tests/configmap_test.yaml b/charts/alfresco-repository/tests/configmap_test.yaml index ead3305e..4c6bacb2 100644 --- a/charts/alfresco-repository/tests/configmap_test.yaml +++ b/charts/alfresco-repository/tests/configmap_test.yaml @@ -54,7 +54,7 @@ tests: asserts: - equal: path: data.DATABASE_URL - value: mysql://sandy:secret@myhost1:1111 + value: jdbc:mysql://sandy:secret@myhost1:1111 - equal: path: data.DATABASE_HOST value: myhost1 @@ -70,11 +70,11 @@ tests: set: configuration: db: - url: postgresql://pghost/alfdb + url: jdbc:postgresql://pghost/alfdb asserts: - equal: path: data.DATABASE_URL - value: postgresql://pghost/alfdb + value: jdbc:postgresql://pghost/alfdb - equal: path: data.DATABASE_HOST value: pghost @@ -94,7 +94,7 @@ tests: asserts: - equal: path: data.DATABASE_URL - value: sqlserver://sqlserverhost;databaseName=alfdb;lockTimeout=1000; + value: jdbc:sqlserver://sqlserverhost;databaseName=alfdb;lockTimeout=1000; - equal: path: data.DATABASE_HOST value: sqlserverhost @@ -110,11 +110,11 @@ tests: set: configuration: db: - url: oracle:thin:@tcp://mydbhost:1521/mydbservice + url: jdbc:oracle:thin:@tcp://mydbhost:1521/mydbservice asserts: - equal: path: data.DATABASE_URL - value: oracle:thin:@tcp://mydbhost:1521/mydbservice + value: jdbc:oracle:thin:@tcp://mydbhost:1521/mydbservice - equal: path: data.DATABASE_HOST value: mydbhost @@ -125,17 +125,6 @@ tests: path: data.DATABASE_DRIVER value: oracle.jdbc.OracleDriver - - it: should fail without proper db URL - template: configmap-repository.yaml - set: - configuration: - db: - url: jdbc:mysql://myhost/db - asserts: - - failedTemplate: - errorMessage: >- - database URL MUST be provided WITHOUT the 'jdbc' prefix. - - it: should render ActiveMQ config as needed template: configmap-mq.yaml asserts: diff --git a/charts/alfresco-repository/values.yaml b/charts/alfresco-repository/values.yaml index 4b81df48..40c14315 100644 --- a/charts/alfresco-repository/values.yaml +++ b/charts/alfresco-repository/values.yaml @@ -34,7 +34,7 @@ configuration: key: license.lic purpose: acs-license db: - # -- JDBC url of the database WITHOUT the "jdbc:" prefix + # -- JDBC url of the database # This is a mandatory parameter url: null # -- JDBC driver class of the driver if none is provided the it is guessed