From 0a04cfc3d59604545180580a11ddfd819af1e991 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 30 Oct 2023 13:07:41 +0100 Subject: [PATCH 1/7] revert optional driverclass (can't work without values) --- 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 f1e58ef8..ed081263 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="{{ printf "${DATABASE_DRIVER:-%s}" (include "alfresco-common.db.driver" .db) }}" + -Ddb.driver="${DATABASE_DRIVER:-%s}" -Dmessaging.broker.url="$BROKER_URL" -Dmessaging.broker.username="$BROKER_USERNAME" -Dmessaging.broker.password="$BROKER_PASSWORD" From a0632c7cbfb00757fcf7c5aecd4f9cafdac688ee Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 30 Oct 2023 13:08:10 +0100 Subject: [PATCH 2/7] typo --- charts/alfresco-repository/templates/secret-database.yaml | 2 +- charts/alfresco-repository/tests/secrets_test.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/alfresco-repository/templates/secret-database.yaml b/charts/alfresco-repository/templates/secret-database.yaml index fd31e4d3..eccca1ba 100644 --- a/charts/alfresco-repository/templates/secret-database.yaml +++ b/charts/alfresco-repository/templates/secret-database.yaml @@ -8,7 +8,7 @@ metadata: labels: {{- include "alfresco-repository.labels" . | nindent 4 }} type: Opaque -{{- $reqmsg := "Either provide database credentiasl as values, or provide a secret that contains them." }} +{{- $reqmsg := "Either provide database credentials as values, or provide a secret that contains them." }} data: DATABASE_USERNAME: {{ required $reqmsg .Values.configuration.db.username | b64enc | quote }} DATABASE_PASSWORD: {{ required $reqmsg .Values.configuration.db.password | b64enc | quote }} diff --git a/charts/alfresco-repository/tests/secrets_test.yaml b/charts/alfresco-repository/tests/secrets_test.yaml index 8e9ab5be..3402b06d 100644 --- a/charts/alfresco-repository/tests/secrets_test.yaml +++ b/charts/alfresco-repository/tests/secrets_test.yaml @@ -9,7 +9,7 @@ tests: asserts: - failedTemplate: errorMessage: >- - Either provide database credentiasl as values, or provide a secret that contains them. + Either provide database credentials as values, or provide a secret that contains them. - it: should not render template set: configuration: From 670ab6b79dd30b699829ce4a8fb843fbc28352fe Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 30 Oct 2023 13:24:12 +0100 Subject: [PATCH 3/7] use env vars rather than tpl in init container cmd --- .../templates/deployment.yaml | 14 ++-- .../tests/deployment_test.yaml | 80 +++++-------------- 2 files changed, 29 insertions(+), 65 deletions(-) diff --git a/charts/alfresco-repository/templates/deployment.yaml b/charts/alfresco-repository/templates/deployment.yaml index 4bd274f8..d423cbd9 100644 --- a/charts/alfresco-repository/templates/deployment.yaml +++ b/charts/alfresco-repository/templates/deployment.yaml @@ -40,13 +40,13 @@ spec: - sh - -c - | - {{- 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 }} + NCTARGET=$(echo DATABASE_URL | awk -F ';|/' '{print $3}') + if [[ "$NCTARGET" == *":"* ]]; then + until nc -vw1 $ + sleep 2 + done + else echo "No port in jdbc URL $DATABASE_URL. Can't guess it so skipping db status check" + fi containers: - name: {{ .Chart.Name }} {{- include "alfresco-common.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 3be76f8f..be83f6a8 100644 --- a/charts/alfresco-repository/tests/deployment_test.yaml +++ b/charts/alfresco-repository/tests/deployment_test.yaml @@ -60,21 +60,6 @@ tests: memory: "8Gi" template: deployment.yaml - - it: should have wait-db-ready initcontainer - asserts: - - equal: - path: spec.template.spec.initContainers[0].name - value: wait-db-ready - template: deployment.yaml - - contains: - path: spec.template.spec.initContainers[0].command - content: | - until nc -w1 myhost1:1111 - do echo 'waiting for mysql database on myhost1:1111' - sleep 2 - done - template: deployment.yaml - - it: should have custom extra volumes when defined set: extraVolumes: @@ -137,6 +122,7 @@ tests: mountPath: /usr/local/tomcat/shared/classes/alfresco/extension/subsystems/Authentication/ldap-ad/myAzureAD readOnly: true template: deployment.yaml + - it: should not have any license volume but vars instead set: configuration: @@ -175,7 +161,7 @@ tests: name: RELEASE-NAME-alfresco-database key: DATABASE_URL - - it: should render configured DATABASE URL + - it: should render deployment using provided database cm set: configuration: db: @@ -193,52 +179,30 @@ 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 + path: spec.template.spec.containers[0].env + content: + name: DATABASE_DRIVER + valueFrom: + configMapKeyRef: + name: mycm + key: DBDRIVER - - it: should render wait-db-ready initcontainer with Oracle server details + - it: should deploy with extra containers values: *test_values set: - configuration: - db: - url: oracle:thin:@tcp://mydbhost:1521/mydbservice + extraInitContainers: + - name: init1 + image: init:latest + extraSideContainers: + - name: sidecar1 + image: sidecar:latest 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 + - lengthEqual: + path: spec.template.spec.initContainers + count: 2 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 + - lengthEqual: + path: spec.template.spec.containers + count: 2 template: deployment.yaml From a9473d43605e7b3377cb7cc4d4c4deac4fc57d5d Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 30 Oct 2023 13:24:34 +0100 Subject: [PATCH 4/7] add extrainitcontainers --- charts/alfresco-repository/templates/deployment.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/charts/alfresco-repository/templates/deployment.yaml b/charts/alfresco-repository/templates/deployment.yaml index d423cbd9..69bf308c 100644 --- a/charts/alfresco-repository/templates/deployment.yaml +++ b/charts/alfresco-repository/templates/deployment.yaml @@ -47,6 +47,9 @@ spec: done else echo "No port in jdbc URL $DATABASE_URL. Can't guess it so skipping db status check" fi + {{- range .Values.extraInitContainers }} + {{- list . | toYaml | nindent 8 }} + {{- end }} containers: - name: {{ .Chart.Name }} {{- include "alfresco-common.component-security-context" .Values | indent 8 }} From 9eba2cabd20d09a28d246c0f53c33940bdfc74f5 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 30 Oct 2023 13:26:43 +0100 Subject: [PATCH 5/7] bump alfresco-repository to 0.1.0-alpha.21 --- charts/alfresco-repository/Chart.yaml | 2 +- charts/alfresco-repository/README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/alfresco-repository/Chart.yaml b/charts/alfresco-repository/Chart.yaml index 0fc5393f..e33c19a5 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.20 +version: 0.1.0-alpha.21 appVersion: 23.1.0-A21 dependencies: - name: alfresco-common diff --git a/charts/alfresco-repository/README.md b/charts/alfresco-repository/README.md index d9db5253..bee90d09 100644 --- a/charts/alfresco-repository/README.md +++ b/charts/alfresco-repository/README.md @@ -1,6 +1,6 @@ # alfresco-repository -![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) +![Version: 0.1.0-alpha.21](https://img.shields.io/badge/Version-0.1.0--alpha.21-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 @@ -133,4 +133,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) From 7246c74cfd826c779a740f904bb3bd8a6cf64387 Mon Sep 17 00:00:00 2001 From: alxgomz Date: Mon, 30 Oct 2023 12:33:53 +0000 Subject: [PATCH 6/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 bee90d09..0e941970 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 496cf1341a1ed12b12f45b3aaee7bc60aa33fb6c Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 30 Oct 2023 15:12:03 +0100 Subject: [PATCH 7/7] fixup --- charts/alfresco-repository/templates/configmap-repository.yaml | 2 +- charts/alfresco-repository/templates/deployment.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/alfresco-repository/templates/configmap-repository.yaml b/charts/alfresco-repository/templates/configmap-repository.yaml index ed081263..0a829980 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:-%s}" + -Ddb.driver="${DATABASE_DRIVER}" -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 69bf308c..fbfae747 100644 --- a/charts/alfresco-repository/templates/deployment.yaml +++ b/charts/alfresco-repository/templates/deployment.yaml @@ -42,7 +42,7 @@ spec: - | NCTARGET=$(echo DATABASE_URL | awk -F ';|/' '{print $3}') if [[ "$NCTARGET" == *":"* ]]; then - until nc -vw1 $ + until nc -vw1 $NCTARGET; do sleep 2 done else echo "No port in jdbc URL $DATABASE_URL. Can't guess it so skipping db status check"