diff --git a/helm/alfresco-content-services/templates/_helpers-database.tpl b/helm/alfresco-content-services/templates/_helpers-database.tpl index acfb76dfb..0f3c85b76 100644 --- a/helm/alfresco-content-services/templates/_helpers-database.tpl +++ b/helm/alfresco-content-services/templates/_helpers-database.tpl @@ -8,10 +8,12 @@ Usage: include "alfresco-content-services.database.repo" $ {{- with .Values }} {{- if and (not .database.url) (not .postgresql.enabled) }} {{- fail "You must either set database.url or postgresql.enabled" }} + {{- end }} + {{- if .database.url }} + {{- .database.url }} {{- else }} {{- $pg_port := .postgresql.primary.service.ports.postgresql | toString }} - {{- $pg_url := printf "postgresql://%s-%s:%s/%s" $.Release.Name .postgresql.nameOverride $pg_port .postgresql.auth.database }} - {{- .database.url | default $pg_url }} + {{- printf "postgresql://%s-%s:%s/%s" $.Release.Name .postgresql.nameOverride $pg_port .postgresql.auth.database }} {{- end }} {{- end }} {{- end -}} @@ -26,10 +28,12 @@ Usage: include "alfresco-content-services.database.sync" $ {{- with .Values }} {{- if and (not .database.sync.url) (not (index . "postgresql-sync" "enabled")) }} {{- fail "You must either set database.sync.url or postgresql-sync.enabled values" }} + {{- end }} + {{- if .database.sync.url }} + {{- .database.sync.url }} {{- else }} {{- $pg_port := index . "postgresql-sync" "primary" "service" "ports" "postgresql" | toString }} - {{- $pg_url := printf "postgresql://%s-%s:%s/%s" $.Release.Name (index . "postgresql-sync" "nameOverride") $pg_port (index . "postgresql-sync" "auth" "database") }} - {{- .database.sync.url | default $pg_url }} + {{- printf "postgresql://%s-%s:%s/%s" $.Release.Name (index . "postgresql-sync" "nameOverride") $pg_port (index . "postgresql-sync" "auth" "database") }} {{- end }} {{- end }} {{- end -}} diff --git a/helm/alfresco-content-services/tests/config-infra_test.yaml b/helm/alfresco-content-services/tests/config-infrastructure_test.yaml similarity index 91% rename from helm/alfresco-content-services/tests/config-infra_test.yaml rename to helm/alfresco-content-services/tests/config-infrastructure_test.yaml index 61ead3652..5024721ec 100644 --- a/helm/alfresco-content-services/tests/config-infra_test.yaml +++ b/helm/alfresco-content-services/tests/config-infrastructure_test.yaml @@ -143,3 +143,13 @@ tests: - failedTemplate: errorMEssage: >- Alfresco Intelligence service has been enabled but Transformation service is not available + + - it: should permit disabling embedded postgresql + values: *testvalues + set: + postgresql.enabled: false + database.url: jdbc:postgresql://alfresco:QA6fMXtdr%3EK%2F8aDFft,MJ%40p%3E@postgres-ha-primary.postgres-operator.svc:5432/alfresco + asserts: + - equal: + path: data.DATABASE_URL + value: jdbc:postgresql://alfresco:QA6fMXtdr%3EK%2F8aDFft,MJ%40p%3E@postgres-ha-primary.postgres-operator.svc:5432/alfresco