Skip to content

Commit

Permalink
OPSEXP-2297: fixup & revert optional driverclass (#140)
Browse files Browse the repository at this point in the history
Co-authored-by: alxgomz <alxgomz@users.noreply.github.com>
  • Loading branch information
alxgomz and alxgomz authored Oct 31, 2023
1 parent c7e32d9 commit 858f71f
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 70 deletions.
2 changes: 1 addition & 1 deletion charts/alfresco-repository/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion charts/alfresco-repository/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
-Dmessaging.broker.url="$BROKER_URL"
-Dmessaging.broker.username="$BROKER_USERNAME"
-Dmessaging.broker.password="$BROKER_PASSWORD"
Expand Down
17 changes: 10 additions & 7 deletions charts/alfresco-repository/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ 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 $NCTARGET; do
sleep 2
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 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/alfresco-repository/templates/secret-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
80 changes: 22 additions & 58 deletions charts/alfresco-repository/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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
2 changes: 1 addition & 1 deletion charts/alfresco-repository/tests/secrets_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 858f71f

Please sign in to comment.