From 0b9418f3a14c71b8116e282b27a7c1e169770348 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 21 Sep 2023 13:04:59 +0200 Subject: [PATCH 01/13] add new required values --- charts/alfresco-search-enterprise/README.md | 5 ++++ .../ci/default-values.yaml | 3 ++ charts/alfresco-search-enterprise/values.yaml | 28 +++++++++++++++---- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/charts/alfresco-search-enterprise/README.md b/charts/alfresco-search-enterprise/README.md index 891a4180..3f60a45b 100644 --- a/charts/alfresco-search-enterprise/README.md +++ b/charts/alfresco-search-enterprise/README.md @@ -20,6 +20,11 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b |-----|------|---------|-------------| | activemq.enabled | bool | `false` | Enable embedded broker - useful when testing this chart in standalone | | affinity | object | `{}` | | +| ats.existingConfigMap.keys.sfs_url | string | `"SFS_URL"` | Key within the configmap holding the URL of the alfresco shared filestore | +| ats.existingConfigMap.keys.transform_url | string | `"ATS_URL"` | Key within the configmap holding the URL of the alfresco transform | +| ats.existingConfigMap.name | string | `nil` | Alternatively, provide ATS details via an existing configmap | +| ats.sfs_url | string | `nil` | URL of the alfresco shared filestore (trouter or tengine-aio) | +| ats.transform_url | string | `nil` | URL of the alfresco transform (trouter or tengine-aio) | | contentMediaTypeCache.enabled | bool | `true` | | | contentMediaTypeCache.refreshTime | string | `"0 0 * * * *"` | | | elasticsearch.clusterHealthCheckParams | string | `"wait_for_status=yellow&timeout=1s"` | | diff --git a/charts/alfresco-search-enterprise/ci/default-values.yaml b/charts/alfresco-search-enterprise/ci/default-values.yaml index e7a246c9..bf056ed0 100644 --- a/charts/alfresco-search-enterprise/ci/default-values.yaml +++ b/charts/alfresco-search-enterprise/ci/default-values.yaml @@ -1,6 +1,9 @@ reindexing: # requires postgres database at startup enabled: false +ats: + transform_url: http://alfresco-transform-services-router + sfs_url: http://alfresco-transform-services-sfs activemq: enabled: true resources: diff --git a/charts/alfresco-search-enterprise/values.yaml b/charts/alfresco-search-enterprise/values.yaml index 25636999..609c668d 100644 --- a/charts/alfresco-search-enterprise/values.yaml +++ b/charts/alfresco-search-enterprise/values.yaml @@ -88,14 +88,24 @@ reindexing: limits: cpu: "0.25" memory: "10Mi" +ats: + # -- URL of the alfresco transform (trouter or tengine-aio) + transform_url: null + # -- URL of the alfresco shared filestore (trouter or tengine-aio) + sfs_url: null + existingConfigMap: + # -- Alternatively, provide ATS details via an existing configmap + name: null + keys: + # -- Key within the configmap holding the URL of the alfresco transform + transform_url: ATS_URL + # -- Key within the configmap holding the URL of the alfresco shared filestore + sfs_url: SFS_URL elasticsearch: # -- Enable embedded elasticsearch - useful when using this chart in standalone enabled: false replicas: 1 clusterHealthCheckParams: "wait_for_status=yellow&timeout=1s" -activemq: - # -- Enable embedded broker - useful when testing this chart in standalone - enabled: false messageBroker: # -- Broker URL formatted as per: # https://activemq.apache.org/failover-transport-reference @@ -104,7 +114,8 @@ messageBroker: user: null # -- Broker password password: null - # -- Provide connection details alternatively via an existing secret that contains BROKER_URL, BROKER_USERNAME and BROKER_PASSWORD keys + # -- Provide connection details alternatively via an existing secret that + # contains BROKER_URL, BROKER_USERNAME and BROKER_PASSWORD keys existingSecretName: null # -- Overrides .Values.global.elasticsearch searchIndex: @@ -118,7 +129,8 @@ searchIndex: user: null # -- The password required to access the service, if any password: null - # -- Alternatively, provide connection details via an an existing secret that contains ELASTICSEARCH_USERNAME and ELASTICSEARCH_PASSWORD keys + # -- Alternatively, provide connection details via an an existing secret that + # contains ELASTICSEARCH_USERNAME and ELASTICSEARCH_PASSWORD keys existingSecretName: null global: alfrescoRegistryPullSecrets: quay-registry-secret @@ -134,5 +146,9 @@ global: user: null # -- The password required to access the service, if any password: null - # -- Alternatively, provide connection details via an existing secret that contains ELASTICSEARCH_USERNAME and ELASTICSEARCH_PASSWORD keys + # -- Alternatively, provide connection details via an existing secret that + # contains ELASTICSEARCH_USERNAME and ELASTICSEARCH_PASSWORD keys existingSecretName: null +activemq: + # -- Enable embedded broker - useful when testing this chart in standalone + enabled: false From 3501dfb598bfb910805b1fd78013764c1d22ed46 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 21 Sep 2023 13:07:26 +0200 Subject: [PATCH 02/13] add template to get ATS venv vars from url --- .../templates/_helpers-ats.tpl | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 charts/alfresco-search-enterprise/templates/_helpers-ats.tpl diff --git a/charts/alfresco-search-enterprise/templates/_helpers-ats.tpl b/charts/alfresco-search-enterprise/templates/_helpers-ats.tpl new file mode 100644 index 00000000..dde5f4b1 --- /dev/null +++ b/charts/alfresco-search-enterprise/templates/_helpers-ats.tpl @@ -0,0 +1,21 @@ +{{/* + +Render Alfresco Trasnform Service related anv vars + +Usage: include "alfresco-search-enterprise.transform.fullurl" "URL" + +*/}} +{{- define "alfresco-search-enterprise.ats.fullurl" -}} + ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL: {{ printf "%s/transform/config" . }} +{{- end -}} + +{{/* + +Render Alfresco Shared Filesotre related anv vars + +Usage: include "alfresco-search-enterprise.sfs.fullurl" "URL" + +*/}} +{{- define "alfresco-search-enterprise.sfs.fullurl" -}} + ALFRESCO_SHAREDFILESTORE_BASEURL: {{ printf "%s/alfresco/api/-default-/private/sfs/versions/1/file/" . }} +{{- end -}} From 537b5f696cb15b206696d67838e49dce1caed663 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 21 Sep 2023 13:30:23 +0200 Subject: [PATCH 03/13] consistency in rendering --- .../templates/_helpers-elasticsearch.tpl | 8 ++++---- .../templates/liveindexing-config.yaml | 14 ++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/charts/alfresco-search-enterprise/templates/_helpers-elasticsearch.tpl b/charts/alfresco-search-enterprise/templates/_helpers-elasticsearch.tpl index f29c3036..c1687746 100644 --- a/charts/alfresco-search-enterprise/templates/_helpers-elasticsearch.tpl +++ b/charts/alfresco-search-enterprise/templates/_helpers-elasticsearch.tpl @@ -1,14 +1,14 @@ {{- define "alfresco-search-enterprise.searchIndexExistingSecretName" -}} -{{ coalesce .Values.searchIndex.existingSecretName .Values.global.elasticsearch.existingSecretName (printf "%s-elasticsearch-secret" (include "alfresco-search-enterprise.fullname" .)) }} +{{- coalesce .Values.searchIndex.existingSecretName .Values.global.elasticsearch.existingSecretName (printf "%s-elasticsearch-secret" (include "alfresco-search-enterprise.fullname" .)) }} {{- end -}} {{- define "alfresco-search-enterprise.config.spring" -}} -{{- if .Values.elasticsearch.enabled }} +{{- if .Values.elasticsearch.enabled -}} SPRING_ELASTICSEARCH_REST_URIS: "{{ .Values.elasticsearch.protocol }}://{{ .Values.elasticsearch.clusterName }}-{{ .Values.elasticsearch.nodeGroup }}:{{ .Values.elasticsearch.httpPort }}" {{- else }} {{- if and (not .Values.global.elasticsearch.host) (not .Values.searchIndex.host) }} - {{ fail "Please provide external elasticsearch connection details as values under .global.elasticsearch or .searchIndex or enable the embedded elasticsearch via .elasticsearch.enabled" }} - {{- end }} + {{- fail "Please provide external elasticsearch connection details as values under .global.elasticsearch or .searchIndex or enable the embedded elasticsearch via .elasticsearch.enabled" }} + {{- end -}} SPRING_ELASTICSEARCH_REST_URIS: "{{ .Values.searchIndex.protocol | default .Values.global.elasticsearch.protocol }}://{{ .Values.searchIndex.host | default .Values.global.elasticsearch.host }}:{{ .Values.searchIndex.port | default .Values.global.elasticsearch.port }}" {{- end -}} {{- end -}} diff --git a/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml b/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml index c370d7db..d7c698b9 100644 --- a/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml +++ b/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.ats.existingConfigMap.name }} apiVersion: v1 kind: ConfigMap metadata: @@ -6,14 +7,15 @@ metadata: {{- include "alfresco-search-enterprise.labels" $ | nindent 4 }} data: ELASTICSEARCH_INDEXNAME: "{{ .Values.indexName }}" - {{- template "alfresco-search-enterprise.config.spring" . }} - ALFRESCO_SHAREDFILESTORE_BASEURL: http://{{ template "alfresco.shortname" . }}-filestore:80/alfresco/api/-default-/private/sfs/versions/1/file/ - ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL: http://{{ template "alfresco.shortname" . }}-router/transform/config + {{ template "alfresco-search-enterprise.config.spring" . }} + {{ template "alfresco-search-enterprise.ats.fullurl" (required "You need to provide the ATS URL using either ats.transform_url value or a configmap" .Values.ats.transform_url) }} + {{ template "alfresco-search-enterprise.sfs.fullurl" (required "You need to provide the SFS URL using either ats.sfs_url value or a configmap" .Values.ats.sfs_url) }} ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_REFRESHTIME: "{{ .Values.contentMediaTypeCache.refreshTime }}" ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_ENABLED: "{{ .Values.contentMediaTypeCache.enabled }}" ALFRESCO_PATHINDEXINGCOMPONENT_ENABLED: "{{ .Values.pathIndexingComponent.enabled }}" {{- if .Values.liveIndexing.environment }} - {{- range $key, $val := .Values.liveIndexing.environment }} - {{ $key }}: {{ $val | quote }} - {{- end }} + {{- range $key, $val := .Values.liveIndexing.environment }} + {{ $key }}: {{ $val | quote }} + {{- end }} {{- end }} +{{- end }} From 8eacfa3c02b933cf27c38502473ab0c3d83b1666 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 21 Sep 2023 13:34:05 +0200 Subject: [PATCH 04/13] add to checkov config --- .checkov-values.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.checkov-values.yml b/.checkov-values.yml index 78d1baeb..8e7a2a44 100644 --- a/.checkov-values.yml +++ b/.checkov-values.yml @@ -19,3 +19,6 @@ elasticsearch: reindexing: db: url: something +ats: + transform_url: http://transform + sfs_url: http://sfs From 4e5ef53ab1a5a59e5b27b611e98a4798602a6920 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 21 Sep 2023 13:39:47 +0200 Subject: [PATCH 05/13] move indexname var to deployment --- .../templates/liveindexing-config.yaml | 1 - .../templates/liveindexing-deployment.yaml | 2 ++ .../alfresco-search-enterprise/templates/reindexing-config.yaml | 1 - charts/alfresco-search-enterprise/templates/reindexing-job.yaml | 2 ++ 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml b/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml index d7c698b9..1094038f 100644 --- a/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml +++ b/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml @@ -6,7 +6,6 @@ metadata: labels: {{- include "alfresco-search-enterprise.labels" $ | nindent 4 }} data: - ELASTICSEARCH_INDEXNAME: "{{ .Values.indexName }}" {{ template "alfresco-search-enterprise.config.spring" . }} {{ template "alfresco-search-enterprise.ats.fullurl" (required "You need to provide the ATS URL using either ats.transform_url value or a configmap" .Values.ats.transform_url) }} {{ template "alfresco-search-enterprise.sfs.fullurl" (required "You need to provide the SFS URL using either ats.sfs_url value or a configmap" .Values.ats.sfs_url) }} diff --git a/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml b/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml index cbe38fa8..9ee32266 100644 --- a/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml +++ b/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml @@ -42,6 +42,8 @@ spec: env: {{- include "spring.activemq.env" . | nindent 12 }} {{- include "alfresco-search-enterprise.config.spring.envCredentials" $ | nindent 12 }} + - name: ELASTICSEARCH_INDEXNAME + value: {{ $.Values.indexName }} ports: - name: http containerPort: 8080 diff --git a/charts/alfresco-search-enterprise/templates/reindexing-config.yaml b/charts/alfresco-search-enterprise/templates/reindexing-config.yaml index 7ad8cad0..7370969a 100644 --- a/charts/alfresco-search-enterprise/templates/reindexing-config.yaml +++ b/charts/alfresco-search-enterprise/templates/reindexing-config.yaml @@ -5,7 +5,6 @@ metadata: labels: {{- include "alfresco-search-enterprise.labels" $ | nindent 4 }} data: - ELASTICSEARCH_INDEXNAME: "{{ .Values.indexName }}" {{ template "alfresco-search-enterprise.config.spring" . }} ALFRESCO_SHAREDFILESTORE_BASEURL: http://{{ template "alfresco.shortname" . }}-filestore:80/alfresco/api/-default-/private/sfs/versions/1/file/ ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL: http://{{ template "alfresco.shortname" . }}-router/transform/config diff --git a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml index 2a2e5633..5023fdc4 100644 --- a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml +++ b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml @@ -32,6 +32,8 @@ spec: env: {{- $dbCtx := dict "Values" (dict "nameOverride" "alfresco-database") "Chart" .Chart "Release" .Release }} {{- $dbFullName := (include "alfresco-search-enterprise.fullname" $dbCtx) }} + - name: ELASTICSEARCH_INDEXNAME + value: {{ .Values.indexName }} - name: SPRING_DATASOURCE_PASSWORD valueFrom: secretKeyRef: From 8eb8888050ab22392b313b2133cb4a71772ea67a Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 21 Sep 2023 14:54:05 +0200 Subject: [PATCH 06/13] move other static env var to deployment using template --- .../templates/_helpers-ats.tpl | 22 +++++++++++++++++-- .../templates/liveindexing-config.yaml | 3 --- .../templates/liveindexing-deployment.yaml | 3 +-- .../templates/reindexing-job.yaml | 3 +-- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/charts/alfresco-search-enterprise/templates/_helpers-ats.tpl b/charts/alfresco-search-enterprise/templates/_helpers-ats.tpl index dde5f4b1..8d4b5da8 100644 --- a/charts/alfresco-search-enterprise/templates/_helpers-ats.tpl +++ b/charts/alfresco-search-enterprise/templates/_helpers-ats.tpl @@ -1,6 +1,6 @@ {{/* -Render Alfresco Trasnform Service related anv vars +Render Alfresco Trasnform Service related env vars Usage: include "alfresco-search-enterprise.transform.fullurl" "URL" @@ -11,7 +11,7 @@ Usage: include "alfresco-search-enterprise.transform.fullurl" "URL" {{/* -Render Alfresco Shared Filesotre related anv vars +Render Alfresco Shared Filesotre related env vars Usage: include "alfresco-search-enterprise.sfs.fullurl" "URL" @@ -19,3 +19,21 @@ Usage: include "alfresco-search-enterprise.sfs.fullurl" "URL" {{- define "alfresco-search-enterprise.sfs.fullurl" -}} ALFRESCO_SHAREDFILESTORE_BASEURL: {{ printf "%s/alfresco/api/-default-/private/sfs/versions/1/file/" . }} {{- end -}} + +{{/* + +Render common env vars + +Usage: include "alfresco-search-enterprise.env" $ + +*/}} +{{- define "alfresco-search-enterprise.env" -}} +- name: ELASTICSEARCH_INDEXNAME + value: {{ .Values.indexName }} +- name: ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_REFRESHTIME + value: {{ .Values.contentMediaTypeCache.refreshTime }} +- name: ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_ENABLED + value: {{ .Values.contentMediaTypeCache.enabled | quote }} +- name: ALFRESCO_PATHINDEXINGCOMPONENT_ENABLED + value: {{ .Values.pathIndexingComponent.enabled | quote }} +{{- end -}} diff --git a/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml b/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml index 1094038f..7f2b8ce6 100644 --- a/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml +++ b/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml @@ -9,9 +9,6 @@ data: {{ template "alfresco-search-enterprise.config.spring" . }} {{ template "alfresco-search-enterprise.ats.fullurl" (required "You need to provide the ATS URL using either ats.transform_url value or a configmap" .Values.ats.transform_url) }} {{ template "alfresco-search-enterprise.sfs.fullurl" (required "You need to provide the SFS URL using either ats.sfs_url value or a configmap" .Values.ats.sfs_url) }} - ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_REFRESHTIME: "{{ .Values.contentMediaTypeCache.refreshTime }}" - ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_ENABLED: "{{ .Values.contentMediaTypeCache.enabled }}" - ALFRESCO_PATHINDEXINGCOMPONENT_ENABLED: "{{ .Values.pathIndexingComponent.enabled }}" {{- if .Values.liveIndexing.environment }} {{- range $key, $val := .Values.liveIndexing.environment }} {{ $key }}: {{ $val | quote }} diff --git a/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml b/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml index 9ee32266..1c44d9a8 100644 --- a/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml +++ b/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml @@ -42,8 +42,7 @@ spec: env: {{- include "spring.activemq.env" . | nindent 12 }} {{- include "alfresco-search-enterprise.config.spring.envCredentials" $ | nindent 12 }} - - name: ELASTICSEARCH_INDEXNAME - value: {{ $.Values.indexName }} + {{- include "alfresco-search-enterprise.env" $ | nindent 12 }} ports: - name: http containerPort: 8080 diff --git a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml index 5023fdc4..18a2ded7 100644 --- a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml +++ b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml @@ -32,8 +32,7 @@ spec: env: {{- $dbCtx := dict "Values" (dict "nameOverride" "alfresco-database") "Chart" .Chart "Release" .Release }} {{- $dbFullName := (include "alfresco-search-enterprise.fullname" $dbCtx) }} - - name: ELASTICSEARCH_INDEXNAME - value: {{ .Values.indexName }} + {{- include "alfresco-search-enterprise.env" $ | nindent 12 }} - name: SPRING_DATASOURCE_PASSWORD valueFrom: secretKeyRef: From 05e14b994a7f8902616b6893a13dae1071efb2c9 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 21 Sep 2023 18:34:38 +0200 Subject: [PATCH 07/13] move reindex "static" env var to deployment & use template in cm --- .../templates/reindexing-config.yaml | 5 ++--- .../alfresco-search-enterprise/templates/reindexing-job.yaml | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/charts/alfresco-search-enterprise/templates/reindexing-config.yaml b/charts/alfresco-search-enterprise/templates/reindexing-config.yaml index 7370969a..e49f0ba2 100644 --- a/charts/alfresco-search-enterprise/templates/reindexing-config.yaml +++ b/charts/alfresco-search-enterprise/templates/reindexing-config.yaml @@ -6,9 +6,8 @@ metadata: {{- include "alfresco-search-enterprise.labels" $ | nindent 4 }} data: {{ template "alfresco-search-enterprise.config.spring" . }} - ALFRESCO_SHAREDFILESTORE_BASEURL: http://{{ template "alfresco.shortname" . }}-filestore:80/alfresco/api/-default-/private/sfs/versions/1/file/ - ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL: http://{{ template "alfresco.shortname" . }}-router/transform/config - ALFRESCO_REINDEX_PATHINDEXINGENABLED: {{ .Values.reindexing.pathIndexingEnabled | quote }} + {{ template "alfresco-search-enterprise.ats.fullurl" (required "You need to provide the ATS URL using either ats.transform_url value or a configmap" .Values.ats.transform_url) }} + {{ template "alfresco-search-enterprise.sfs.fullurl" (required "You need to provide the SFS URL using either ats.sfs_url value or a configmap" .Values.ats.sfs_url) }} {{- if .Values.reindexing.environment }} {{- range $key, $val := .Values.reindexing.environment }} {{ $key }}: {{ $val | quote }} diff --git a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml index 18a2ded7..8d324513 100644 --- a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml +++ b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml @@ -33,6 +33,8 @@ spec: {{- $dbCtx := dict "Values" (dict "nameOverride" "alfresco-database") "Chart" .Chart "Release" .Release }} {{- $dbFullName := (include "alfresco-search-enterprise.fullname" $dbCtx) }} {{- include "alfresco-search-enterprise.env" $ | nindent 12 }} + - name: ALFRESCO_REINDEX_PATHINDEXINGENABLED + value: {{ .Values.reindexing.pathIndexingEnabled | quote }} - name: SPRING_DATASOURCE_PASSWORD valueFrom: secretKeyRef: From 9b8f8cb8b2719033ad408a8381b7a67b7f4be12d Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 21 Sep 2023 19:46:46 +0200 Subject: [PATCH 08/13] align tests with latest changes --- .../tests/liveindexing-deployment_test.yaml | 52 ++++---- .../tests/reindexing-job_test.yaml | 125 +++++++++--------- .../tests/values/embedded-charts-values.yaml | 5 +- 3 files changed, 95 insertions(+), 87 deletions(-) diff --git a/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml b/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml index 4accee50..6dd38941 100644 --- a/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml +++ b/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml @@ -10,10 +10,11 @@ tests: - it: | Render elasticsearch Liveindexing configmap, using global config to ensure it overrides default values. + values: &testvalues + - values/embedded-charts-values.yaml set: - activemq: - enabled: true - global.elasticsearch: + global: + elasticsearch: host: someglobally.used.host user: admin protocol: https @@ -25,31 +26,35 @@ tests: template: liveindexing-config.yaml - it: | - Render elasticsearch Liveindexing configmap, - using embedded elasticsearch chart. - values: &testvalues - - values/embedded-charts-values.yaml + Render default mainfest with embedded elasticsearch and pre-existing secret + values: *testvalues + template: liveindexing-deployment.yaml + set: + elasticsearch: + enabled: true + searchIndex: + existingSecretName: nooneknows asserts: - equal: path: data.SPRING_ELASTICSEARCH_REST_URIS value: http://elasticsearch-master:9200 template: liveindexing-config.yaml - - - it: should have env vars for elasticsearch credentials - values: *testvalues - asserts: - - equal: - path: spec.template.spec.containers[0].env[3].name - value: SPRING_ELASTICSEARCH_REST_USERNAME - template: liveindexing-deployment.yaml - - equal: - path: spec.template.spec.containers[0].env[4].name - value: SPRING_ELASTICSEARCH_REST_PASSWORD - template: liveindexing-deployment.yaml - - - it: should render cpu and memory limits - values: *testvalues - asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: SPRING_ELASTICSEARCH_REST_USERNAME + valueFrom: + secretKeyRef: + name: nooneknows + key: ELASTICSEARCH_USERNAME + - contains: + path: spec.template.spec.containers[0].env + content: + name: SPRING_ELASTICSEARCH_REST_PASSWORD + valueFrom: + secretKeyRef: + name: nooneknows + key: ELASTICSEARCH_PASSWORD - equal: path: spec.template.spec.containers[0].resources value: @@ -59,4 +64,3 @@ tests: limits: cpu: "2" memory: "2048Mi" - template: liveindexing-deployment.yaml diff --git a/charts/alfresco-search-enterprise/tests/reindexing-job_test.yaml b/charts/alfresco-search-enterprise/tests/reindexing-job_test.yaml index 2521ad21..e8e72ae2 100644 --- a/charts/alfresco-search-enterprise/tests/reindexing-job_test.yaml +++ b/charts/alfresco-search-enterprise/tests/reindexing-job_test.yaml @@ -5,35 +5,30 @@ templates: tests: - it: should have env vars for spring database credentials referencing the main chart secret asserts: - - equal: - path: spec.template.spec.containers[0].env[0].name - value: SPRING_DATASOURCE_PASSWORD - - equal: - path: spec.template.spec.containers[0].env[0].valueFrom.secretKeyRef.name - value: RELEASE-NAME-alfresco-database - - equal: - path: spec.template.spec.containers[0].env[0].valueFrom.secretKeyRef.key - value: DATABASE_PASSWORD - - - equal: - path: spec.template.spec.containers[0].env[1].name - value: SPRING_DATASOURCE_USERNAME - - equal: - path: spec.template.spec.containers[0].env[1].valueFrom.secretKeyRef.name - value: RELEASE-NAME-alfresco-database - - equal: - path: spec.template.spec.containers[0].env[1].valueFrom.secretKeyRef.key - value: DATABASE_USERNAME - - - equal: - path: spec.template.spec.containers[0].env[2].name - value: SPRING_DATASOURCE_URL - - equal: - path: spec.template.spec.containers[0].env[2].valueFrom.configMapKeyRef.name - value: RELEASE-NAME-alfresco-database - - equal: - path: spec.template.spec.containers[0].env[2].valueFrom.configMapKeyRef.key - value: DATABASE_URL + - contains: + path: spec.template.spec.containers[0].env + content: + name: SPRING_DATASOURCE_PASSWORD + valueFrom: + secretKeyRef: + name: RELEASE-NAME-alfresco-database + key: DATABASE_PASSWORD + - contains: + path: spec.template.spec.containers[0].env + content: + name: SPRING_DATASOURCE_USERNAME + valueFrom: + secretKeyRef: + name: RELEASE-NAME-alfresco-database + key: DATABASE_USERNAME + - contains: + path: spec.template.spec.containers[0].env + content: + name: SPRING_DATASOURCE_URL + valueFrom: + configMapKeyRef: + name: RELEASE-NAME-alfresco-database + key: DATABASE_URL - it: should have overridden secret for spring database credentials when existingSecretName is set set: @@ -48,41 +43,49 @@ tests: keys: url: CUSTOM_URL_KEY asserts: - - equal: - path: spec.template.spec.containers[0].env[0].valueFrom.secretKeyRef.name - value: my-custom-secret - - equal: - path: spec.template.spec.containers[0].env[0].valueFrom.secretKeyRef.key - value: CUSTOM_PASSWORD_KEY - - - equal: - path: spec.template.spec.containers[0].env[1].valueFrom.secretKeyRef.name - value: my-custom-secret - - equal: - path: spec.template.spec.containers[0].env[1].valueFrom.secretKeyRef.key - value: CUSTOM_USERNAME_KEY - - - equal: - path: spec.template.spec.containers[0].env[2].valueFrom.configMapKeyRef.name - value: my-custom-configmap - - equal: - path: spec.template.spec.containers[0].env[2].valueFrom.configMapKeyRef.key - value: CUSTOM_URL_KEY + - contains: + path: spec.template.spec.containers[0].env + content: + name: SPRING_DATASOURCE_USERNAME + valueFrom: + secretKeyRef: + name: my-custom-secret + key: CUSTOM_USERNAME_KEY + - contains: + path: spec.template.spec.containers[0].env + content: + name: SPRING_DATASOURCE_PASSWORD + valueFrom: + secretKeyRef: + name: my-custom-secret + key: CUSTOM_PASSWORD_KEY + - contains: + path: spec.template.spec.containers[0].env + content: + name: SPRING_DATASOURCE_URL + valueFrom: + configMapKeyRef: + name: my-custom-configmap + key: CUSTOM_URL_KEY - it: should have env vars for elasticsearch credentials asserts: - - equal: - path: spec.template.spec.containers[0].env[6].name - value: SPRING_ELASTICSEARCH_REST_USERNAME - - equal: - path: spec.template.spec.containers[0].env[6].valueFrom.secretKeyRef.name - value: RELEASE-NAME-alfresco-search-enterprise-elasticsearch-secret - - equal: - path: spec.template.spec.containers[0].env[7].name - value: SPRING_ELASTICSEARCH_REST_PASSWORD - - equal: - path: spec.template.spec.containers[0].env[7].valueFrom.secretKeyRef.name - value: RELEASE-NAME-alfresco-search-enterprise-elasticsearch-secret + - contains: + path: spec.template.spec.containers[0].env + content: + name: SPRING_ELASTICSEARCH_REST_USERNAME + valueFrom: + secretKeyRef: + name: RELEASE-NAME-alfresco-search-enterprise-elasticsearch-secret + key: ELASTICSEARCH_USERNAME + - contains: + path: spec.template.spec.containers[0].env + content: + name: SPRING_ELASTICSEARCH_REST_PASSWORD + valueFrom: + secretKeyRef: + name: RELEASE-NAME-alfresco-search-enterprise-elasticsearch-secret + key: ELASTICSEARCH_PASSWORD - it: should not be present when disabled set: diff --git a/charts/alfresco-search-enterprise/tests/values/embedded-charts-values.yaml b/charts/alfresco-search-enterprise/tests/values/embedded-charts-values.yaml index 1ec39eea..99f1b5fb 100644 --- a/charts/alfresco-search-enterprise/tests/values/embedded-charts-values.yaml +++ b/charts/alfresco-search-enterprise/tests/values/embedded-charts-values.yaml @@ -1,4 +1,5 @@ activemq: enabled: true -elasticsearch: - enabled: true +ats: + transform_url: http://transform + sfs_url: http://sfs From db554f159c20e6d0a2daf485b54f80f4ce09ce80 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 21 Sep 2023 19:54:19 +0200 Subject: [PATCH 09/13] move env vars to deployment/job --- .../templates/liveindexing-config.yaml | 5 ----- .../templates/liveindexing-deployment.yaml | 4 ++++ .../templates/reindexing-config.yaml | 5 ----- .../alfresco-search-enterprise/templates/reindexing-job.yaml | 4 ++++ 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml b/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml index 7f2b8ce6..ae63e966 100644 --- a/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml +++ b/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml @@ -9,9 +9,4 @@ data: {{ template "alfresco-search-enterprise.config.spring" . }} {{ template "alfresco-search-enterprise.ats.fullurl" (required "You need to provide the ATS URL using either ats.transform_url value or a configmap" .Values.ats.transform_url) }} {{ template "alfresco-search-enterprise.sfs.fullurl" (required "You need to provide the SFS URL using either ats.sfs_url value or a configmap" .Values.ats.sfs_url) }} - {{- if .Values.liveIndexing.environment }} - {{- range $key, $val := .Values.liveIndexing.environment }} - {{ $key }}: {{ $val | quote }} - {{- end }} - {{- end }} {{- end }} diff --git a/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml b/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml index 1c44d9a8..25d9a677 100644 --- a/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml +++ b/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml @@ -43,6 +43,10 @@ spec: {{- include "spring.activemq.env" . | nindent 12 }} {{- include "alfresco-search-enterprise.config.spring.envCredentials" $ | nindent 12 }} {{- include "alfresco-search-enterprise.env" $ | nindent 12 }} + {{- range $key, $val := $.Values.liveIndexing.environment }} + - name: {{ $key }} + value: {{ $val | quote }} + {{- end }} ports: - name: http containerPort: 8080 diff --git a/charts/alfresco-search-enterprise/templates/reindexing-config.yaml b/charts/alfresco-search-enterprise/templates/reindexing-config.yaml index e49f0ba2..8c898793 100644 --- a/charts/alfresco-search-enterprise/templates/reindexing-config.yaml +++ b/charts/alfresco-search-enterprise/templates/reindexing-config.yaml @@ -8,8 +8,3 @@ data: {{ template "alfresco-search-enterprise.config.spring" . }} {{ template "alfresco-search-enterprise.ats.fullurl" (required "You need to provide the ATS URL using either ats.transform_url value or a configmap" .Values.ats.transform_url) }} {{ template "alfresco-search-enterprise.sfs.fullurl" (required "You need to provide the SFS URL using either ats.sfs_url value or a configmap" .Values.ats.sfs_url) }} - {{- if .Values.reindexing.environment }} - {{- range $key, $val := .Values.reindexing.environment }} - {{ $key }}: {{ $val | quote }} - {{- end }} - {{- end }} diff --git a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml index 8d324513..42627aba 100644 --- a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml +++ b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml @@ -33,6 +33,10 @@ spec: {{- $dbCtx := dict "Values" (dict "nameOverride" "alfresco-database") "Chart" .Chart "Release" .Release }} {{- $dbFullName := (include "alfresco-search-enterprise.fullname" $dbCtx) }} {{- include "alfresco-search-enterprise.env" $ | nindent 12 }} + {{- range $key, $val := .Values.reindexing.environment }} + - name: {{ $key }} + value: {{ $val | quote }} + {{- end }} - name: ALFRESCO_REINDEX_PATHINDEXINGENABLED value: {{ .Values.reindexing.pathIndexingEnabled | quote }} - name: SPRING_DATASOURCE_PASSWORD From e3980e65fb7575ab53048f1e610c8f08850b2646 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 21 Sep 2023 19:56:32 +0200 Subject: [PATCH 10/13] bump alfresco-search-enterprise subchart & its dependencies --- charts/alfresco-search-enterprise/Chart.lock | 6 +++--- charts/alfresco-search-enterprise/Chart.yaml | 4 ++-- charts/alfresco-search-enterprise/README.md | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/charts/alfresco-search-enterprise/Chart.lock b/charts/alfresco-search-enterprise/Chart.lock index 19f3d83f..32d2d9fd 100644 --- a/charts/alfresco-search-enterprise/Chart.lock +++ b/charts/alfresco-search-enterprise/Chart.lock @@ -1,12 +1,12 @@ dependencies: - name: alfresco-common repository: https://alfresco.github.io/alfresco-helm-charts/ - version: 2.1.0 + version: 3.0.0-alpha.1 - name: activemq repository: https://alfresco.github.io/alfresco-helm-charts/ version: 3.3.0 - name: elasticsearch repository: https://helm.elastic.co version: 7.17.3 -digest: sha256:d542f131a0a88f216fdfefa55a132ad373051776e52f6cb334ad8b30dbdf5137 -generated: "2023-09-20T17:55:19.77609+02:00" +digest: sha256:3217395d08bca2dca3ada26c8045f92409e4173deb0e881dd0d020c975b6217c +generated: "2023-09-21T19:55:50.962494+02:00" diff --git a/charts/alfresco-search-enterprise/Chart.yaml b/charts/alfresco-search-enterprise/Chart.yaml index 77b663e0..98180a07 100644 --- a/charts/alfresco-search-enterprise/Chart.yaml +++ b/charts/alfresco-search-enterprise/Chart.yaml @@ -3,11 +3,11 @@ apiVersion: v2 name: alfresco-search-enterprise description: A Helm chart for deploying Alfresco Elasticsearch connector type: application -version: 2.0.0 +version: 3.0.0-alpha.1 appVersion: 3.3.1 dependencies: - name: alfresco-common - version: 2.1.0 + version: 3.0.0-alpha.1 repository: https://alfresco.github.io/alfresco-helm-charts/ - name: activemq version: 3.3.0 diff --git a/charts/alfresco-search-enterprise/README.md b/charts/alfresco-search-enterprise/README.md index 3f60a45b..66b069e3 100644 --- a/charts/alfresco-search-enterprise/README.md +++ b/charts/alfresco-search-enterprise/README.md @@ -1,6 +1,6 @@ # alfresco-search-enterprise -![Version: 2.0.0](https://img.shields.io/badge/Version-2.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.3.1](https://img.shields.io/badge/AppVersion-3.3.1-informational?style=flat-square) +![Version: 3.0.0-alpha.1](https://img.shields.io/badge/Version-3.0.0--alpha.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.3.1](https://img.shields.io/badge/AppVersion-3.3.1-informational?style=flat-square) A Helm chart for deploying Alfresco Elasticsearch connector @@ -11,7 +11,7 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b | Repository | Name | Version | |------------|------|---------| | https://alfresco.github.io/alfresco-helm-charts/ | activemq | 3.3.0 | -| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 2.1.0 | +| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.0.0-alpha.1 | | https://helm.elastic.co | elasticsearch | 7.17.3 | ## Values From 33b4693bd3f44a4f76bba70da4e70b48e885f025 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 21 Sep 2023 21:28:34 +0200 Subject: [PATCH 11/13] support for custom cm & keys --- .../templates/_helpers-ats.tpl | 4 ++-- .../templates/liveindexing-deployment.yaml | 13 +++++++++++-- .../templates/reindexing-config.yaml | 2 ++ .../templates/reindexing-job.yaml | 13 +++++++++++-- .../tests/liveindexing-deployment_test.yaml | 8 ++++++++ 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/charts/alfresco-search-enterprise/templates/_helpers-ats.tpl b/charts/alfresco-search-enterprise/templates/_helpers-ats.tpl index 8d4b5da8..12e2ad9b 100644 --- a/charts/alfresco-search-enterprise/templates/_helpers-ats.tpl +++ b/charts/alfresco-search-enterprise/templates/_helpers-ats.tpl @@ -6,7 +6,7 @@ Usage: include "alfresco-search-enterprise.transform.fullurl" "URL" */}} {{- define "alfresco-search-enterprise.ats.fullurl" -}} - ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL: {{ printf "%s/transform/config" . }} + ATS_URL: {{ printf "%s/transform/config" . }} {{- end -}} {{/* @@ -17,7 +17,7 @@ Usage: include "alfresco-search-enterprise.sfs.fullurl" "URL" */}} {{- define "alfresco-search-enterprise.sfs.fullurl" -}} - ALFRESCO_SHAREDFILESTORE_BASEURL: {{ printf "%s/alfresco/api/-default-/private/sfs/versions/1/file/" . }} + SFS_URL: {{ printf "%s/alfresco/api/-default-/private/sfs/versions/1/file/" . }} {{- end -}} {{/* diff --git a/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml b/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml index 25d9a677..58a55b35 100644 --- a/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml +++ b/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml @@ -35,11 +35,20 @@ spec: imagePullPolicy: {{ index $.Values "liveIndexing" (printf "%s" $serviceName) "image" "pullPolicy" }} {{- include "component-security-context" .Values | indent 8 }} envFrom: - - configMapRef: - name: {{ template "alfresco-search-enterprise.fullname" $ }}-configmap - secretRef: name: {{ default (printf "%s-messagebroker-secret" (include "alfresco-search-enterprise.fullname" $)) $.Values.messageBroker.existingSecretName }} env: + {{- $ats_cm := $.Values.ats.existingConfigMap.name | default (printf "%s-configmap" (include "alfresco-search-enterprise.fullname" $)) }} + - name: ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL + valueFrom: + configMapKeyRef: + name: {{ $ats_cm }} + key: {{ $.Values.ats.existingConfigMap.keys.transform_url }} + - name: ALFRESCO_SHAREDFILESTORE_BASEURL + valueFrom: + configMapKeyRef: + name: {{ $ats_cm }} + key: {{ $.Values.ats.existingConfigMap.keys.sfs_url }} {{- include "spring.activemq.env" . | nindent 12 }} {{- include "alfresco-search-enterprise.config.spring.envCredentials" $ | nindent 12 }} {{- include "alfresco-search-enterprise.env" $ | nindent 12 }} diff --git a/charts/alfresco-search-enterprise/templates/reindexing-config.yaml b/charts/alfresco-search-enterprise/templates/reindexing-config.yaml index 8c898793..1e87aa03 100644 --- a/charts/alfresco-search-enterprise/templates/reindexing-config.yaml +++ b/charts/alfresco-search-enterprise/templates/reindexing-config.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.ats.existingConfigMap.name }} apiVersion: v1 kind: ConfigMap metadata: @@ -8,3 +9,4 @@ data: {{ template "alfresco-search-enterprise.config.spring" . }} {{ template "alfresco-search-enterprise.ats.fullurl" (required "You need to provide the ATS URL using either ats.transform_url value or a configmap" .Values.ats.transform_url) }} {{ template "alfresco-search-enterprise.sfs.fullurl" (required "You need to provide the SFS URL using either ats.sfs_url value or a configmap" .Values.ats.sfs_url) }} +{{- end }} diff --git a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml index 42627aba..b11f4efe 100644 --- a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml +++ b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml @@ -25,13 +25,22 @@ spec: {{- include "component-security-context" .Values | indent 8 }} resources: {{- toYaml .Values.reindexing.resources | nindent 12 }} envFrom: - - configMapRef: - name: {{ template "alfresco-search-enterprise.fullname" . }}-reindexing-configmap - secretRef: name: {{ default (printf "%s-messagebroker-secret" (include "alfresco-search-enterprise.fullname" .)) .Values.messageBroker.existingSecretName }} env: {{- $dbCtx := dict "Values" (dict "nameOverride" "alfresco-database") "Chart" .Chart "Release" .Release }} {{- $dbFullName := (include "alfresco-search-enterprise.fullname" $dbCtx) }} + {{- $ats_cm := .Values.ats.existingConfigMap.name | default (printf "%s-configmap" (include "alfresco-search-enterprise.fullname" .)) }} + - name: ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL + valueFrom: + configMapKeyRef: + name: {{ $ats_cm }} + key: {{ .Values.ats.existingConfigMap.keys.transform_url }} + - name: ALFRESCO_SHAREDFILESTORE_BASEURL + valueFrom: + configMapKeyRef: + name: {{ $ats_cm }} + key: {{ .Values.ats.existingConfigMap.keys.sfs_url }} {{- include "alfresco-search-enterprise.env" $ | nindent 12 }} {{- range $key, $val := .Values.reindexing.environment }} - name: {{ $key }} diff --git a/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml b/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml index 6dd38941..6fb5df9a 100644 --- a/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml +++ b/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml @@ -35,6 +35,14 @@ tests: searchIndex: existingSecretName: nooneknows asserts: + - equal: + path: data.ATS_URL + value: http://transform/transform/config + template: liveindexing-config.yaml + - equal: + path: data.SFS_URL + value: http://sfs/alfresco/api/-default-/private/sfs/versions/1/file/ + template: liveindexing-config.yaml - equal: path: data.SPRING_ELASTICSEARCH_REST_URIS value: http://elasticsearch-master:9200 From 3ff81a186978ee52648606fe5689088fb6a426a5 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 21 Sep 2023 22:56:53 +0200 Subject: [PATCH 12/13] split cm by service --- .../{liveindexing-config.yaml => config-ats.yaml} | 3 +-- .../templates/config-elasticsearch.yaml | 8 ++++++++ .../templates/liveindexing-deployment.yaml | 4 +++- .../templates/reindexing-config.yaml | 12 ------------ .../templates/reindexing-job.yaml | 4 +++- .../tests/liveindexing-deployment_test.yaml | 11 ++++++----- 6 files changed, 21 insertions(+), 21 deletions(-) rename charts/alfresco-search-enterprise/templates/{liveindexing-config.yaml => config-ats.yaml} (79%) create mode 100644 charts/alfresco-search-enterprise/templates/config-elasticsearch.yaml delete mode 100644 charts/alfresco-search-enterprise/templates/reindexing-config.yaml diff --git a/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml b/charts/alfresco-search-enterprise/templates/config-ats.yaml similarity index 79% rename from charts/alfresco-search-enterprise/templates/liveindexing-config.yaml rename to charts/alfresco-search-enterprise/templates/config-ats.yaml index ae63e966..4af93372 100644 --- a/charts/alfresco-search-enterprise/templates/liveindexing-config.yaml +++ b/charts/alfresco-search-enterprise/templates/config-ats.yaml @@ -2,11 +2,10 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ template "alfresco-search-enterprise.fullname" . }}-configmap + name: {{ template "alfresco-search-enterprise.fullname" . }}-ats labels: {{- include "alfresco-search-enterprise.labels" $ | nindent 4 }} data: - {{ template "alfresco-search-enterprise.config.spring" . }} {{ template "alfresco-search-enterprise.ats.fullurl" (required "You need to provide the ATS URL using either ats.transform_url value or a configmap" .Values.ats.transform_url) }} {{ template "alfresco-search-enterprise.sfs.fullurl" (required "You need to provide the SFS URL using either ats.sfs_url value or a configmap" .Values.ats.sfs_url) }} {{- end }} diff --git a/charts/alfresco-search-enterprise/templates/config-elasticsearch.yaml b/charts/alfresco-search-enterprise/templates/config-elasticsearch.yaml new file mode 100644 index 00000000..8f4b242f --- /dev/null +++ b/charts/alfresco-search-enterprise/templates/config-elasticsearch.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "alfresco-search-enterprise.fullname" . }}-es + labels: + {{- include "alfresco-search-enterprise.labels" $ | nindent 4 }} +data: + {{ template "alfresco-search-enterprise.config.spring" . }} diff --git a/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml b/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml index 58a55b35..d2d574ef 100644 --- a/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml +++ b/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml @@ -37,8 +37,10 @@ spec: envFrom: - secretRef: name: {{ default (printf "%s-messagebroker-secret" (include "alfresco-search-enterprise.fullname" $)) $.Values.messageBroker.existingSecretName }} + - configMapRef: + name: {{ template "alfresco-search-enterprise.fullname" $ }}-es env: - {{- $ats_cm := $.Values.ats.existingConfigMap.name | default (printf "%s-configmap" (include "alfresco-search-enterprise.fullname" $)) }} + {{- $ats_cm := $.Values.ats.existingConfigMap.name | default (printf "%s-ats" (include "alfresco-search-enterprise.fullname" $)) }} - name: ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL valueFrom: configMapKeyRef: diff --git a/charts/alfresco-search-enterprise/templates/reindexing-config.yaml b/charts/alfresco-search-enterprise/templates/reindexing-config.yaml deleted file mode 100644 index 1e87aa03..00000000 --- a/charts/alfresco-search-enterprise/templates/reindexing-config.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if not .Values.ats.existingConfigMap.name }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "alfresco-search-enterprise.fullname" . }}-reindexing-configmap - labels: - {{- include "alfresco-search-enterprise.labels" $ | nindent 4 }} -data: - {{ template "alfresco-search-enterprise.config.spring" . }} - {{ template "alfresco-search-enterprise.ats.fullurl" (required "You need to provide the ATS URL using either ats.transform_url value or a configmap" .Values.ats.transform_url) }} - {{ template "alfresco-search-enterprise.sfs.fullurl" (required "You need to provide the SFS URL using either ats.sfs_url value or a configmap" .Values.ats.sfs_url) }} -{{- end }} diff --git a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml index b11f4efe..34f0e389 100644 --- a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml +++ b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml @@ -25,12 +25,14 @@ spec: {{- include "component-security-context" .Values | indent 8 }} resources: {{- toYaml .Values.reindexing.resources | nindent 12 }} envFrom: + - configMapRef: + name: {{ template "alfresco-search-enterprise.fullname" . }}-es - secretRef: name: {{ default (printf "%s-messagebroker-secret" (include "alfresco-search-enterprise.fullname" .)) .Values.messageBroker.existingSecretName }} env: {{- $dbCtx := dict "Values" (dict "nameOverride" "alfresco-database") "Chart" .Chart "Release" .Release }} {{- $dbFullName := (include "alfresco-search-enterprise.fullname" $dbCtx) }} - {{- $ats_cm := .Values.ats.existingConfigMap.name | default (printf "%s-configmap" (include "alfresco-search-enterprise.fullname" .)) }} + {{- $ats_cm := .Values.ats.existingConfigMap.name | default (printf "%s-ats" (include "alfresco-search-enterprise.fullname" .)) }} - name: ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL valueFrom: configMapKeyRef: diff --git a/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml b/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml index 6fb5df9a..19829caf 100644 --- a/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml +++ b/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml @@ -1,7 +1,8 @@ --- suite: test liveindexing template rendering templates: - - liveindexing-config.yaml + - config-ats.yaml + - config-elasticsearch.yaml - liveindexing-deployment.yaml - secret-elasticsearch.yaml - secret-database.yaml @@ -23,7 +24,7 @@ tests: - equal: path: data.SPRING_ELASTICSEARCH_REST_URIS value: https://someglobally.used.host:1443 - template: liveindexing-config.yaml + template: config-elasticsearch.yaml - it: | Render default mainfest with embedded elasticsearch and pre-existing secret @@ -38,15 +39,15 @@ tests: - equal: path: data.ATS_URL value: http://transform/transform/config - template: liveindexing-config.yaml + template: config-ats.yaml - equal: path: data.SFS_URL value: http://sfs/alfresco/api/-default-/private/sfs/versions/1/file/ - template: liveindexing-config.yaml + template: config-ats.yaml - equal: path: data.SPRING_ELASTICSEARCH_REST_URIS value: http://elasticsearch-master:9200 - template: liveindexing-config.yaml + template: config-elasticsearch.yaml - contains: path: spec.template.spec.containers[0].env content: From 3ff83d733fadbda7b6c2d4076659637a46fb9270 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 22 Sep 2023 10:56:15 +0200 Subject: [PATCH 13/13] review comments --- charts/alfresco-search-enterprise/README.md | 2 +- charts/alfresco-search-enterprise/values.yaml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/charts/alfresco-search-enterprise/README.md b/charts/alfresco-search-enterprise/README.md index 66b069e3..ae3e1fa8 100644 --- a/charts/alfresco-search-enterprise/README.md +++ b/charts/alfresco-search-enterprise/README.md @@ -23,7 +23,7 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b | ats.existingConfigMap.keys.sfs_url | string | `"SFS_URL"` | Key within the configmap holding the URL of the alfresco shared filestore | | ats.existingConfigMap.keys.transform_url | string | `"ATS_URL"` | Key within the configmap holding the URL of the alfresco transform | | ats.existingConfigMap.name | string | `nil` | Alternatively, provide ATS details via an existing configmap | -| ats.sfs_url | string | `nil` | URL of the alfresco shared filestore (trouter or tengine-aio) | +| ats.sfs_url | string | `nil` | URL of the alfresco shared filestore | | ats.transform_url | string | `nil` | URL of the alfresco transform (trouter or tengine-aio) | | contentMediaTypeCache.enabled | bool | `true` | | | contentMediaTypeCache.refreshTime | string | `"0 0 * * * *"` | | diff --git a/charts/alfresco-search-enterprise/values.yaml b/charts/alfresco-search-enterprise/values.yaml index 609c668d..491adfcf 100644 --- a/charts/alfresco-search-enterprise/values.yaml +++ b/charts/alfresco-search-enterprise/values.yaml @@ -91,7 +91,7 @@ reindexing: ats: # -- URL of the alfresco transform (trouter or tengine-aio) transform_url: null - # -- URL of the alfresco shared filestore (trouter or tengine-aio) + # -- URL of the alfresco shared filestore sfs_url: null existingConfigMap: # -- Alternatively, provide ATS details via an existing configmap @@ -101,11 +101,6 @@ ats: transform_url: ATS_URL # -- Key within the configmap holding the URL of the alfresco shared filestore sfs_url: SFS_URL -elasticsearch: - # -- Enable embedded elasticsearch - useful when using this chart in standalone - enabled: false - replicas: 1 - clusterHealthCheckParams: "wait_for_status=yellow&timeout=1s" messageBroker: # -- Broker URL formatted as per: # https://activemq.apache.org/failover-transport-reference @@ -152,3 +147,8 @@ global: activemq: # -- Enable embedded broker - useful when testing this chart in standalone enabled: false +elasticsearch: + # -- Enable embedded elasticsearch - useful when using this chart in standalone + enabled: false + replicas: 1 + clusterHealthCheckParams: "wait_for_status=yellow&timeout=1s"