From 33cdd059f8f043b1939eec62695a142b0e4758aa Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 27 Oct 2023 14:43:16 +0200 Subject: [PATCH 1/7] bump alfresco-common dependency in alfresco-repository --- charts/alfresco-repository/Chart.yaml | 2 +- charts/alfresco-repository/README.md | 4 ++-- charts/alfresco-repository/templates/_helpers-database.tpl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/alfresco-repository/Chart.yaml b/charts/alfresco-repository/Chart.yaml index b941fb19..a2a994fb 100644 --- a/charts/alfresco-repository/Chart.yaml +++ b/charts/alfresco-repository/Chart.yaml @@ -6,7 +6,7 @@ version: 0.1.0-alpha.19 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..c66af092 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.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 @@ -135,4 +135,4 @@ Alfresco content repository Helm chart | tolerations | list | `[]` | | ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0) +Autogenerated from chart metadata using [helm-docs v1.11.3](https://github.com/norwoodj/helm-docs/releases/v1.11.3) diff --git a/charts/alfresco-repository/templates/_helpers-database.tpl b/charts/alfresco-repository/templates/_helpers-database.tpl index 999b2a77..55eee2ca 100644 --- a/charts/alfresco-repository/templates/_helpers-database.tpl +++ b/charts/alfresco-repository/templates/_helpers-database.tpl @@ -40,6 +40,6 @@ 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_PORT: {{ include "alfresco-common.db.port" .url | quote }} DATABASE_DRIVER: {{ template "alfresco-common.db.driver" . }} {{- end -}} From 91b557ef1af846f7dcbffdf88920544eccc8161c Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 27 Oct 2023 15:13:49 +0200 Subject: [PATCH 2/7] remove the need for DATABASE_HOST & DATABASE_PORT vars --- charts/alfresco-repository/README.md | 2 -- .../templates/_helpers-database.tpl | 12 ------------ charts/alfresco-repository/templates/deployment.yaml | 7 +++++-- .../alfresco-repository/tests/deployment_test.yaml | 4 ++-- charts/alfresco-repository/values.yaml | 8 -------- 5 files changed, 7 insertions(+), 26 deletions(-) diff --git a/charts/alfresco-repository/README.md b/charts/alfresco-repository/README.md index c66af092..e393161b 100644 --- a/charts/alfresco-repository/README.md +++ b/charts/alfresco-repository/README.md @@ -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 55eee2ca..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" .url | quote }} DATABASE_DRIVER: {{ template "alfresco-common.db.driver" . }} {{- end -}} diff --git a/charts/alfresco-repository/templates/deployment.yaml b/charts/alfresco-repository/templates/deployment.yaml index b7994714..6a3cb39c 100644 --- a/charts/alfresco-repository/templates/deployment.yaml +++ b/charts/alfresco-repository/templates/deployment.yaml @@ -40,10 +40,13 @@ 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 }} diff --git a/charts/alfresco-repository/tests/deployment_test.yaml b/charts/alfresco-repository/tests/deployment_test.yaml index 94c373bb..4b48712c 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 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. From 4825f26a650b173d96e93cf824a640ce26d3c298 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 27 Oct 2023 15:30:44 +0200 Subject: [PATCH 3/7] move tests from cm to deploy --- .../tests/configmap_test.yaml | 24 --------- .../tests/deployment_test.yaml | 49 +++++++++++++++++++ 2 files changed, 49 insertions(+), 24 deletions(-) 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 4b48712c..3be76f8f 100644 --- a/charts/alfresco-repository/tests/deployment_test.yaml +++ b/charts/alfresco-repository/tests/deployment_test.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 From 351a2baaf0ddfa1e90d1770cd22c7315bbf5ef5c Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 27 Oct 2023 16:47:38 +0200 Subject: [PATCH 4/7] make DATABASE_VRIVER var optional --- charts/alfresco-repository/templates/configmap-repository.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From 75561297a187e0b45d6588fd0120aa9d1bf77916 Mon Sep 17 00:00:00 2001 From: alxgomz Date: Fri, 27 Oct 2023 14:55:05 +0000 Subject: [PATCH 5/7] Apply automatic changes --- charts/alfresco-repository/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/alfresco-repository/README.md b/charts/alfresco-repository/README.md index e393161b..1a8a1f57 100644 --- a/charts/alfresco-repository/README.md +++ b/charts/alfresco-repository/README.md @@ -133,4 +133,4 @@ Alfresco content repository Helm chart | tolerations | list | `[]` | | ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.11.3](https://github.com/norwoodj/helm-docs/releases/v1.11.3) +Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0) From 8f3aaf75a4d3207ab121fa0ddd20b613dbedc9ef Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 27 Oct 2023 17:29:19 +0200 Subject: [PATCH 6/7] bump alfresco-repository to 0.1.0-alpha.20 --- charts/alfresco-repository/Chart.lock | 6 +++--- charts/alfresco-repository/Chart.yaml | 2 +- charts/alfresco-repository/README.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) 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 a2a994fb..0fc5393f 100644 --- a/charts/alfresco-repository/Chart.yaml +++ b/charts/alfresco-repository/Chart.yaml @@ -2,7 +2,7 @@ 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 diff --git a/charts/alfresco-repository/README.md b/charts/alfresco-repository/README.md index 1a8a1f57..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 From f912965390f8b2a6e9d70e654558c74ac4118adb Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 27 Oct 2023 17:41:27 +0200 Subject: [PATCH 7/7] use fqtn --- charts/alfresco-repository/templates/deployment.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/charts/alfresco-repository/templates/deployment.yaml b/charts/alfresco-repository/templates/deployment.yaml index 6a3cb39c..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" @@ -49,7 +49,7 @@ spec: {{- 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 }} @@ -192,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: