diff --git a/charts/alfresco-repository/Chart.lock b/charts/alfresco-repository/Chart.lock index fb98242b..3a1e501b 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: 3.0.0-alpha.3 + version: 3.0.0-alpha.4 - name: postgresql repository: oci://registry-1.docker.io/bitnamicharts version: 12.5.6 -digest: sha256:fc5f240540fd10560dca1e88b13601b18128e2fbf0ed0b52ab9294ad58dff037 -generated: "2023-10-18T14:43:10.28712+02:00" +digest: sha256:569e88f1d311e341437a62bae88d6bca83b986d8f40cb9bbafd4f33aa4e9ed8f +generated: "2023-10-27T17:28:14.899057+02:00" diff --git a/charts/alfresco-repository/Chart.yaml b/charts/alfresco-repository/Chart.yaml index b941fb19..0fc5393f 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.19 +version: 0.1.0-alpha.20 appVersion: 23.1.0-A21 dependencies: - name: alfresco-common - version: 3.0.0-alpha.3 + version: 3.0.0-alpha.4 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 dd00a424..d9db5253 100644 --- a/charts/alfresco-repository/README.md +++ b/charts/alfresco-repository/README.md @@ -1,6 +1,6 @@ # alfresco-repository -![Version: 0.1.0-alpha.19](https://img.shields.io/badge/Version-0.1.0--alpha.19-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.20](https://img.shields.io/badge/Version-0.1.0--alpha.20-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 | 3.0.0-alpha.3 | +| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.0.0-alpha.4 | | oci://registry-1.docker.io/bitnamicharts | postgresql | 12.5.6 | ## Values @@ -20,8 +20,6 @@ Alfresco content repository Helm chart | command | list | `[]` | | | configuration.db.driver | string | `nil` | JDBC driver class of the driver if none is provided the it is guessed from the URL provided | | configuration.db.existingConfigMap.keys.driver | string | `"DATABASE_DRIVER"` | configmap key where to find the JDBC driver class to use. The configmap may leverage the alfresco-repository.db.cm named template to auto-generate it from the sole url parameter. | -| configuration.db.existingConfigMap.keys.host | string | `"DATABASE_HOST"` | configmap key where to find the hostname part of the database URL. The configmap may leverage the alfresco-repository.db.cm named template to auto-generate it from the sole url parameter. | -| configuration.db.existingConfigMap.keys.port | string | `"DATABASE_PORT"` | configmap key where to find the port part of the database URL. The configmap may leverage the alfresco-repository.db.cm named template to auto-generate it from the sole url parameter. | | configuration.db.existingConfigMap.keys.url | string | `"DATABASE_URL"` | configmap key where to find the URL of the database | | configuration.db.existingConfigMap.name | string | `nil` | | | configuration.db.existingSecret | object | `{"keys":{"password":"DATABASE_PASSWORD","username":"DATABASE_USERNAME"},"name":null}` | Existing secret and their keys where to find the database username & password. | diff --git a/charts/alfresco-repository/templates/_helpers-database.tpl b/charts/alfresco-repository/templates/_helpers-database.tpl index 999b2a77..9d808c5c 100644 --- a/charts/alfresco-repository/templates/_helpers-database.tpl +++ b/charts/alfresco-repository/templates/_helpers-database.tpl @@ -13,16 +13,6 @@ Usage: include "alfresco-repository.db.env" $ configMapKeyRef: name: {{ $dbcm }} key: {{ .existingConfigMap.keys.url }} -- name: DATABASE_HOST - valueFrom: - configMapKeyRef: - name: {{ $dbcm }} - key: {{ .existingConfigMap.keys.host }} -- name: DATABASE_PORT - valueFrom: - configMapKeyRef: - name: {{ $dbcm }} - key: {{ .existingConfigMap.keys.port }} - name: DATABASE_DRIVER valueFrom: configMapKeyRef: @@ -39,7 +29,5 @@ Usage: include "alfresco-repository.db.cm" (dict "url" "" "driver" "") */}} {{- define "alfresco-repository.db.cm" -}} 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" . }} {{- end -}} diff --git a/charts/alfresco-repository/templates/configmap-repository.yaml b/charts/alfresco-repository/templates/configmap-repository.yaml index 2394cca7..f1e58ef8 100644 --- a/charts/alfresco-repository/templates/configmap-repository.yaml +++ b/charts/alfresco-repository/templates/configmap-repository.yaml @@ -16,7 +16,7 @@ data: -Ddb.url="$DATABASE_URL" -Ddb.username=${DATABASE_USERNAME} -Ddb.password=${DATABASE_PASSWORD} - -Ddb.driver="$DATABASE_DRIVER" + -Ddb.driver="{{ printf "${DATABASE_DRIVER:-%s}" (include "alfresco-common.db.driver" .db) }}" -Dmessaging.broker.url="$BROKER_URL" -Dmessaging.broker.username="$BROKER_USERNAME" -Dmessaging.broker.password="$BROKER_PASSWORD" diff --git a/charts/alfresco-repository/templates/deployment.yaml b/charts/alfresco-repository/templates/deployment.yaml index b7994714..4bd274f8 100644 --- a/charts/alfresco-repository/templates/deployment.yaml +++ b/charts/alfresco-repository/templates/deployment.yaml @@ -21,15 +21,15 @@ spec: {{- include "alfresco-repository.selectorLabels" . | nindent 8 }} spec: serviceAccountName: {{ include "alfresco-repository.serviceAccountName" . }} - {{- include "component-pod-security-context" .Values | indent 4 }} + {{- include "alfresco-common.component-pod-security-context" .Values | indent 4 }} nodeSelector: {{- toYaml .Values.nodeSelector | nindent 8 }} - {{- include "alfresco-content-services.imagePullSecrets" . | indent 6 }} + {{- include "alfresco-common.imagePullSecrets" . | indent 6 }} initContainers: - name: wait-db-ready image: busybox:1.35 imagePullPolicy: IfNotPresent - {{- include "component-security-context" dict | indent 8 }} + {{- include "alfresco-common.component-security-context" dict | indent 8 }} resources: limits: cpu: "0.25" @@ -40,13 +40,16 @@ spec: - sh - -c - | - until nc -w1 $(DATABASE_HOST):$(DATABASE_PORT) - do echo "waiting for database on $(DATABASE_HOST):$(DATABASE_PORT)" + {{- with .Values.configuration.db }} + {{- $dbsocket := printf "%s:%s" (include "alfresco-common.db.hostname" .url) (include "alfresco-common.db.port" .url) }} + until nc -w1 {{ $dbsocket }} + do echo 'waiting for {{ template "alfresco-common.db.rdbms" .url }} database on {{ $dbsocket }}' sleep 2 done + {{- end }} containers: - name: {{ .Chart.Name }} - {{- include "component-security-context" .Values | indent 8 }} + {{- include "alfresco-common.component-security-context" .Values | indent 8 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} {{- $dbsecretCtx := dict }} @@ -189,7 +192,7 @@ spec: {{ tpl (toYaml (list .)) $ | nindent 8 }} {{- end }} volumes: - {{- include "data_volume" .Values | nindent 8 }} + {{- include "alfresco-common.data_volume" .Values | nindent 8 }} {{- if .Values.configuration.repository.existingConfigMap }} - name: global-properties configMap: diff --git a/charts/alfresco-repository/tests/configmap_test.yaml b/charts/alfresco-repository/tests/configmap_test.yaml index 38e8a77f..d29e23c7 100644 --- a/charts/alfresco-repository/tests/configmap_test.yaml +++ b/charts/alfresco-repository/tests/configmap_test.yaml @@ -59,12 +59,6 @@ tests: - equal: path: data.DATABASE_URL value: jdbc:mysql://sandy:secret@myhost1:1111 - - equal: - path: data.DATABASE_HOST - value: myhost1 - - equal: - path: data.DATABASE_PORT - value: "1111" - equal: path: data.DATABASE_DRIVER value: com.mysql.jdbc.Driver @@ -79,12 +73,6 @@ tests: - equal: path: data.DATABASE_URL value: jdbc:postgresql://pghost/alfdb - - equal: - path: data.DATABASE_HOST - value: pghost - - equal: - path: data.DATABASE_PORT - value: "5432" - equal: path: data.DATABASE_DRIVER value: org.postgresql.Driver @@ -99,12 +87,6 @@ tests: - equal: path: data.DATABASE_URL value: jdbc:sqlserver://sqlserverhost;databaseName=alfdb;lockTimeout=1000; - - equal: - path: data.DATABASE_HOST - value: sqlserverhost - - equal: - path: data.DATABASE_PORT - value: "1434" - equal: path: data.DATABASE_DRIVER value: com.microsoft.sqlserver.jdbc.SQLServerDriver @@ -119,12 +101,6 @@ tests: - equal: path: data.DATABASE_URL value: jdbc:oracle:thin:@tcp://mydbhost:1521/mydbservice - - equal: - path: data.DATABASE_HOST - value: mydbhost - - equal: - path: data.DATABASE_PORT - value: "1521" - equal: path: data.DATABASE_DRIVER value: oracle.jdbc.OracleDriver diff --git a/charts/alfresco-repository/tests/deployment_test.yaml b/charts/alfresco-repository/tests/deployment_test.yaml index 94c373bb..3be76f8f 100644 --- a/charts/alfresco-repository/tests/deployment_test.yaml +++ b/charts/alfresco-repository/tests/deployment_test.yaml @@ -69,8 +69,8 @@ tests: - contains: path: spec.template.spec.initContainers[0].command content: | - until nc -w1 $(DATABASE_HOST):$(DATABASE_PORT) - do echo "waiting for database on $(DATABASE_HOST):$(DATABASE_PORT)" + until nc -w1 myhost1:1111 + do echo 'waiting for mysql database on myhost1:1111' sleep 2 done template: deployment.yaml @@ -193,3 +193,52 @@ tests: configMapKeyRef: name: mycm key: DBURL + + + - it: should render wait-db-ready initcontainer with PostgreSQL server details + values: *test_values + set: + configuration: + db: + url: jdbc:postgresql://pghost/alfdb + asserts: + - contains: + path: spec.template.spec.initContainers[0].command + content: | + until nc -w1 pghost:5432 + do echo 'waiting for postgresql database on pghost:5432' + sleep 2 + done + template: deployment.yaml + + - it: should render wait-db-ready initcontainer with Oracle server details + values: *test_values + set: + configuration: + db: + url: oracle:thin:@tcp://mydbhost:1521/mydbservice + asserts: + - contains: + path: spec.template.spec.initContainers[0].command + content: | + until nc -w1 mydbhost:1521 + do echo 'waiting for oracle database on mydbhost:1521' + sleep 2 + done + template: deployment.yaml + + - it: should render wait-db-ready initcontainer with MQ SQL server details + values: *test_values + set: + configuration: + db: + url: sqlserver://sqlserverhost;databaseName=alfdb;lockTimeout=1000; + asserts: + - contains: + path: spec.template.spec.initContainers[0].command + content: | + until nc -w1 sqlserverhost:1434 + do echo 'waiting for sqlserver database on sqlserverhost:1434' + sleep 2 + done + template: deployment.yaml diff --git a/charts/alfresco-repository/values.yaml b/charts/alfresco-repository/values.yaml index d5a23f3a..350fc026 100644 --- a/charts/alfresco-repository/values.yaml +++ b/charts/alfresco-repository/values.yaml @@ -60,14 +60,6 @@ configuration: keys: # -- configmap key where to find the URL of the database url: DATABASE_URL - # -- configmap key where to find the hostname part of the database URL. - # The configmap may leverage the alfresco-repository.db.cm named - # template to auto-generate it from the sole url parameter. - host: DATABASE_HOST - # -- configmap key where to find the port part of the database URL. - # The configmap may leverage the alfresco-repository.db.cm named - # template to auto-generate it from the sole url parameter. - port: DATABASE_PORT # -- configmap key where to find the JDBC driver class to use. # The configmap may leverage the alfresco-repository.db.cm named # template to auto-generate it from the sole url parameter.