From d13c0c4badf9c8ea38202f9ceddbd529460dc599 Mon Sep 17 00:00:00 2001 From: Alex Chapellon Date: Tue, 26 Sep 2023 09:14:06 +0200 Subject: [PATCH] OPSEXP-2242: allow jdbc prefix in repo url (#118) Co-authored-by: alxgomz --- charts/alfresco-repository/Chart.lock | 6 ++--- charts/alfresco-repository/Chart.yaml | 4 ++-- charts/alfresco-repository/README.md | 6 ++--- .../templates/_helpers-database.tpl | 2 +- .../templates/configmap-repository.yaml | 2 +- .../templates/deployment.yaml | 2 +- .../tests/configmap_test.yaml | 23 +++++-------------- charts/alfresco-repository/values.yaml | 2 +- 8 files changed, 18 insertions(+), 29 deletions(-) diff --git a/charts/alfresco-repository/Chart.lock b/charts/alfresco-repository/Chart.lock index e31c7727..99a8846a 100644 --- a/charts/alfresco-repository/Chart.lock +++ b/charts/alfresco-repository/Chart.lock @@ -1,9 +1,9 @@ dependencies: - name: alfresco-common repository: https://alfresco.github.io/alfresco-helm-charts/ - version: 2.1.0 + version: 3.0.0-alpha.2 - name: postgresql repository: oci://registry-1.docker.io/bitnamicharts version: 12.5.6 -digest: sha256:043a1323627d74eed9c3675ebe4c704df37d01011d07fb704fa24f1a81703c1b -generated: "2023-09-07T16:17:44.513368+02:00" +digest: sha256:8b29bc4958ca18fce2e9b0fe2d8d21b4628cb3e1c13f90226378fe6ac3fbd9ff +generated: "2023-09-25T15:51:04.023194318Z" diff --git a/charts/alfresco-repository/Chart.yaml b/charts/alfresco-repository/Chart.yaml index 90bc5128..905d07d6 100644 --- a/charts/alfresco-repository/Chart.yaml +++ b/charts/alfresco-repository/Chart.yaml @@ -2,11 +2,11 @@ apiVersion: v2 name: alfresco-repository description: Alfresco content repository Helm chart type: application -version: 0.1.0-alpha.8 +version: 0.1.0-alpha.9 appVersion: 23.1.0-A21 dependencies: - name: alfresco-common - version: 2.1.0 + 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 620670a8..15e8b4ff 100644 --- a/charts/alfresco-repository/README.md +++ b/charts/alfresco-repository/README.md @@ -1,6 +1,6 @@ # alfresco-repository -![Version: 0.1.0-alpha.8](https://img.shields.io/badge/Version-0.1.0--alpha.8-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 23.1.0-A21](https://img.shields.io/badge/AppVersion-23.1.0--A21-informational?style=flat-square) +![Version: 0.1.0-alpha.9](https://img.shields.io/badge/Version-0.1.0--alpha.9-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 23.1.0-A21](https://img.shields.io/badge/AppVersion-23.1.0--A21-informational?style=flat-square) Alfresco content repository Helm chart @@ -8,7 +8,7 @@ Alfresco content repository Helm chart | Repository | Name | Version | |------------|------|---------| -| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 2.1.0 | +| 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/templates/deployment.yaml b/charts/alfresco-repository/templates/deployment.yaml index dc64a2fa..49ca4f62 100644 --- a/charts/alfresco-repository/templates/deployment.yaml +++ b/charts/alfresco-repository/templates/deployment.yaml @@ -188,7 +188,7 @@ spec: {{- range .Values.configuration.repository.existingSecrets }} {{- if eq "acs-license" .purpose }} {{- $licitems := list (dict "key" .key "path" "license.lic") }} - {{- $licvol := dict "name" "acs-license" "secret" (dict "secretName" .name "defaultMode" 0400 "optional" true "items" $licitems ) }} + {{- $licvol := dict "name" "acs-license" "secret" (dict "secretName" .name "defaultMode" 0400 "optional" true "items" $licitems) }} {{- list $licvol | toYaml | nindent 8 }} {{- else if and (hasPrefix "subsystems:" (.purpose | default "")) (eq (splitList ":" (.purpose | default "") | len) 3) }} {{- $subsysvol := dict "name" .name "secret" (dict "secretName" .name "defaultMode" 0400) }} 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