Skip to content

Commit

Permalink
OPSEXP-2242: allow jdbc prefix in repo url (#118)
Browse files Browse the repository at this point in the history
Co-authored-by: alxgomz <[email protected]>
  • Loading branch information
alxgomz and alxgomz authored Sep 26, 2023
1 parent 71a3ab7 commit d13c0c4
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 29 deletions.
6 changes: 3 additions & 3 deletions charts/alfresco-repository/Chart.lock
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 2 additions & 2 deletions charts/alfresco-repository/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions charts/alfresco-repository/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# 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

## Requirements

| 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
Expand Down Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion charts/alfresco-repository/templates/_helpers-database.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion charts/alfresco-repository/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}
Expand Down
23 changes: 6 additions & 17 deletions charts/alfresco-repository/tests/configmap_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion charts/alfresco-repository/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d13c0c4

Please sign in to comment.