Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPSEXP-2298: allow elasticsearch configuration using the same existingResource or values approach #136

Merged
merged 15 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions charts/alfresco-search-enterprise/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ dependencies:
- name: elasticsearch
repository: https://helm.elastic.co
version: 7.17.3
digest: sha256:d1d6c8303e0953b98f5e315fdcf120bc037f227843e785df66abd68e3150ea90
generated: "2023-10-19T19:42:24.344873+02:00"
digest: sha256:add38efb79f9791c5d302b13ed108b74adb77fdbffac66a7d6ce7fa9df05fa21
generated: "2023-10-20T18:43:51.870175+02:00"
5 changes: 3 additions & 2 deletions charts/alfresco-search-enterprise/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v2
name: alfresco-search-enterprise
description: A Helm chart for deploying Alfresco Elasticsearch connector
type: application
version: 3.0.0-alpha.5
version: 3.0.0-alpha.6
appVersion: 3.3.1
dependencies:
- name: alfresco-common
Expand All @@ -17,4 +17,5 @@ dependencies:
- name: elasticsearch
repository: https://helm.elastic.co
version: 7.17.3
condition: elasticsearch.enabled
tags:
- ci
29 changes: 10 additions & 19 deletions charts/alfresco-search-enterprise/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# alfresco-search-enterprise

![Version: 3.0.0-alpha.5](https://img.shields.io/badge/Version-3.0.0--alpha.5-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.6](https://img.shields.io/badge/Version-3.0.0--alpha.6-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

Expand All @@ -26,18 +26,8 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b
| 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"` | |
| elasticsearch.enabled | bool | `false` | Enable embedded elasticsearch - useful when using this chart in standalone |
| elasticsearch.replicas | int | `1` | |
| fullnameOverride | string | `""` | |
| global.alfrescoRegistryPullSecrets | string | `"quay-registry-secret"` | |
| global.elasticsearch | object | `{"existingSecretName":null,"host":null,"password":null,"port":null,"protocol":null,"user":null}` | Shared connections details for Elasticsearch/Opensearch cluster |
| global.elasticsearch.existingSecretName | string | `nil` | Alternatively, provide connection details via an existing secret that contains ELASTICSEARCH_USERNAME and ELASTICSEARCH_PASSWORD keys |
| global.elasticsearch.host | string | `nil` | The host where service is available |
| global.elasticsearch.password | string | `nil` | The password required to access the service, if any |
| global.elasticsearch.port | string | `nil` | The port where service is available |
| global.elasticsearch.protocol | string | `nil` | Valid values are http or https |
| global.elasticsearch.user | string | `nil` | The username required to access the service, if any |
| imagePullSecrets | list | `[]` | |
| indexName | string | `"alfresco"` | Name of the existing search index, usually created by repo |
| liveIndexing.content.image.pullPolicy | string | `"IfNotPresent"` | |
Expand All @@ -55,8 +45,8 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b
| liveIndexing.path.image.repository | string | `"quay.io/alfresco/alfresco-elasticsearch-live-indexing-path"` | |
| liveIndexing.path.image.tag | string | `"3.3.1"` | |
| liveIndexing.path.replicaCount | int | `1` | |
| messageBroker.existingConfigMap | object | `{"keys":{"url":"BROKER_URL"},"name":null}` | Alternatively, provide message broker connection details via an existing configmap |
| messageBroker.existingConfigMap.keys.url | string | `"BROKER_URL"` | Key within the configmap holding the URL of the message broker |
| messageBroker.existingConfigMap.name | string | `nil` | Alternatively, provide message broker connection details via an existing configmap |
| messageBroker.existingSecret | object | `{"keys":{"password":"BROKER_PASSWORD","username":"BROKER_USERNAME"},"name":null}` | Provide connection details alternatively via an existing secret that contains BROKER_URL, BROKER_USERNAME and BROKER_PASSWORD keys |
| messageBroker.password | string | `nil` | Broker password |
| messageBroker.url | string | `nil` | Broker URL formatted as per: https://activemq.apache.org/failover-transport-reference |
Expand Down Expand Up @@ -92,13 +82,14 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b
| resources.limits.memory | string | `"2048Mi"` | |
| resources.requests.cpu | string | `"0.5"` | |
| resources.requests.memory | string | `"256Mi"` | |
| searchIndex | object | `{"existingSecretName":null,"host":null,"password":null,"port":null,"protocol":null,"user":null}` | Overrides .Values.global.elasticsearch |
| searchIndex.existingSecretName | string | `nil` | Alternatively, provide connection details via an an existing secret that contains ELASTICSEARCH_USERNAME and ELASTICSEARCH_PASSWORD keys |
| searchIndex.host | string | `nil` | The host where service is available |
| searchIndex.password | string | `nil` | The password required to access the service, if any |
| searchIndex.port | string | `nil` | The port where service is available |
| searchIndex.protocol | string | `nil` | Valid values are http or https |
| searchIndex.user | string | `nil` | The username required to access the service, if any |
| search.existingConfigMap.keys.url | string | `"SEARCH_URL"` | Key within the configmap holding the URL of the search/indexing service |
| search.existingConfigMap.name | string | `nil` | Alternatively, provide search/indexing service connection details via an existing configmap |
| search.existingSecret.keys.password | string | `"SEARCH_PASSWORD"` | Key within the secret that holds the search/indexing password |
| search.existingSecret.keys.username | string | `"SEARCH_USERNAME"` | Key within the secret that holds the search/indexing username |
| search.existingSecret.name | string | `nil` | Alternatively, provide search/indexing credentials via an existing secret |
| search.password | string | `nil` | The password required to access the search/indexing service, if any |
| search.url | string | `nil` | The URL where the search/indexing service is available |
| search.user | string | `nil` | The username required to access the search/indexing service, if any |
| securityContext | object | `{}` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
Expand Down
5 changes: 4 additions & 1 deletion charts/alfresco-search-enterprise/ci/default-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ resources:
limits:
cpu: "1"
memory: "1Gi"
search:
url: http://elasticsearch-master:9200
elasticsearch:
enabled: true
replicas: 1
clusterHealthCheckParams: "wait_for_status=yellow&timeout=1s"
esJavaOpts: "-Xmx512m -Xms512m"
resources:
requests:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
{{- define "alfresco-search-enterprise.searchIndexExistingSecretName" -}}
{{- 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 -}}
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 -}}
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 -}}
Usage: include "alfresco-search-enterprise.config.spring.es.env" $

*/}}
{{- define "alfresco-search-enterprise.config.spring.es.env" -}}
{{- $esCtx := dict "Values" (dict "nameOverride" (printf "%s-%s" (.Values.nameOverride | default .Chart.Name) "es")) "Chart" .Chart "Release" .Release }}
{{- with .Values.search }}
{{- $esCm := coalesce .existingConfigMap.name (include "alfresco-search-enterprise.fullname" $esCtx) }}
- name: SPRING_ELASTICSEARCH_REST_URIS
valueFrom:
configMapKeyRef:
name: {{ $esCm }}
key: {{ .existingConfigMap.keys.url }}
{{- end }}
{{- end -}}

{{/*

Usage: include "alfresco-search-enterprise.config.spring.envCredentials" $

*/}}
{{- define "alfresco-search-enterprise.config.spring.envCredentials" -}}
{{- $esCtx := dict "Values" (dict "nameOverride" (printf "%s-%s" (.Values.nameOverride | default .Chart.Name) "es")) "Chart" .Chart "Release" .Release }}
{{- with .Values.search }}
{{- $esSecret := coalesce .existingSecret.name (include "alfresco-search-enterprise.fullname" $esCtx) }}
- name: SPRING_ELASTICSEARCH_REST_USERNAME
valueFrom:
secretKeyRef:
name: {{ template "alfresco-search-enterprise.searchIndexExistingSecretName" $ }}
key: ELASTICSEARCH_USERNAME
name: {{ $esSecret }}
key: {{ .existingSecret.keys.username }}
- name: SPRING_ELASTICSEARCH_REST_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "alfresco-search-enterprise.searchIndexExistingSecretName" $ }}
key: ELASTICSEARCH_PASSWORD
name: {{ $esSecret }}
key: {{ .existingSecret.keys.password }}
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{{- with .Values.search }}
{{- if not .existingConfigMap.name }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "alfresco-search-enterprise.fullname" . }}-es
{{- $ctx := dict "Values" (dict "nameOverride" (printf "%s-%s" ($.Values.nameOverride | default $.Chart.Name) "es")) "Chart" $.Chart "Release" $.Release }}
name: {{ template "alfresco-search-enterprise.fullname" $ctx }}
labels:
{{- include "alfresco-search-enterprise.labels" $ | nindent 4 }}
data:
{{ template "alfresco-search-enterprise.config.spring" . }}
{{- $reqMsg := "Please provide elasticsearch connection details as .search.url values or using an .search.existingConfigMap." }}
{{- $esProtocol := required $reqMsg (include "alfresco-common.url.scheme" .url) }}
{{- $esHost := required $reqMsg (include "alfresco-common.url.host" .url) }}
{{- $esPort := required $reqMsg (include "alfresco-common.url.port" .url) }}
SEARCH_URL: {{ printf "%s://%s:%v" $esProtocol $esHost $esPort }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,13 @@ spec :
{{ index $.Values "liveIndexing" (printf "%s" $serviceName) "image" "tag" }}"
imagePullPolicy: {{ index $.Values "liveIndexing" (printf "%s" $serviceName) "image" "pullPolicy" }}
{{- include "alfresco-common.component-security-context" .Values | indent 8 }}
envFrom:
- configMapRef:
name: {{ template "alfresco-search-enterprise.fullname" $ }}-es
env:
{{- include "alfresco-search-enterprise.activemq.secret.env" $ | nindent 12 }}
{{- include "alfresco-search-enterprise.activemq.cm.env" $ | nindent 12 }}
{{- include "alfresco-common.spring.activemq.env" . | nindent 12 }}
{{- include "alfresco-search-enterprise.config.spring.envCredentials" $ | nindent 12 }}
{{- include "alfresco-search-enterprise.config.spring.es.env" $ | nindent 12 }}
{{- include "alfresco-search-enterprise.env" $ | nindent 12 }}
{{- range $key, $val := $.Values.liveIndexing.environment }}
{{- $atsCtx := dict "Values" (dict "nameOverride" (printf "%s-%s" ($.Values.nameOverride | default $.Chart.Name) "ats")) "Chart" $.Chart "Release" $.Release }}
{{- $ats_cm := coalesce $.Values.ats.existingConfigMap.name (include "alfresco-search-enterprise.fullname" $atsCtx) }}
- name: ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL
Expand All @@ -57,6 +54,7 @@ spec :
configMapKeyRef:
name: {{ $ats_cm }}
key: {{ $.Values.ats.existingConfigMap.keys.sfs_url }}
{{- range $key, $val := $.Values.liveIndexing.environment }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ spec:
imagePullPolicy: {{ .Values.reindexing.image.pullPolicy }}
{{- include "alfresco-common.component-security-context" .Values | indent 8 }}
resources: {{- toYaml .Values.reindexing.resources | nindent 12 }}
envFrom:
- configMapRef:
name: {{ template "alfresco-search-enterprise.fullname" . }}-es
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-ats" (include "alfresco-search-enterprise.fullname" .)) }}
{{- include "alfresco-search-enterprise.activemq.secret.env" . | nindent 12 }}
{{- include "alfresco-search-enterprise.activemq.cm.env" . | nindent 12 }}
{{- include "alfresco-common.spring.activemq.env" . | nindent 12 }}
{{- include "alfresco-search-enterprise.config.spring.es.env" $ | nindent 12 }}
{{- include "alfresco-search-enterprise.config.spring.envCredentials" . | nindent 12 }}
- name: ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL
valueFrom:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{{- if and (not .Values.global.elasticsearch.existingSecretName) (not .Values.searchIndex.existingSecretName) }}
{{- with .Values.search }}
{{- if not .existingSecret.name }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "alfresco-search-enterprise.fullname" . }}-elasticsearch-secret
{{- $ctx := dict "Values" (dict "nameOverride" (printf "%s-%s" ($.Values.nameOverride | default $.Chart.Name) "es")) "Chart" $.Chart "Release" $.Release }}
name: {{ template "alfresco-search-enterprise.fullname" $ctx }}
labels:
{{- include "alfresco-search-enterprise.labels" $ | nindent 4 }}
type: Opaque
data:
ELASTICSEARCH_USERNAME: {{ .Values.searchIndex.user | default .Values.global.elasticsearch.user | default "" | b64enc | quote }}
ELASTICSEARCH_PASSWORD: {{ .Values.searchIndex.password | default .Values.global.elasticsearch.password | default "" | b64enc | quote }}
SEARCH_USERNAME: {{ .username | default "" | b64enc | quote }}
SEARCH_PASSWORD: {{ .password | default "" | b64enc | quote }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,14 @@ templates:
tests:
- it: |
Render elasticsearch Liveindexing configmap,
using global config to ensure it overrides default values.
using provided values and check deployment has appropriate defaults
values: &testvalues
- values/embedded-charts-values.yaml
set:
global:
elasticsearch:
host: someglobally.used.host
user: admin
protocol: https
port: 1443
template: liveindexing-deployment.yaml
asserts:
- equal:
path: data.SPRING_ELASTICSEARCH_REST_URIS
value: https://someglobally.used.host:1443
path: data.SEARCH_URL
value: http://elasticsearch-master:9200
template: configmap-elasticsearch.yaml
- contains:
path: spec.template.spec.containers[0].env
Expand All @@ -34,16 +27,62 @@ tests:
configMapKeyRef:
name: RELEASE-NAME-alfresco-search-enterprise-mq
key: BROKER_URL
- contains:
path: spec.template.spec.containers[0].env
content:
name: SPRING_ELASTICSEARCH_REST_URIS
valueFrom:
configMapKeyRef:
name: RELEASE-NAME-alfresco-search-enterprise-es
key: SEARCH_URL
- contains:
path: spec.template.spec.containers[0].env
content:
name: SPRING_ELASTICSEARCH_REST_USERNAME
valueFrom:
secretKeyRef:
name: RELEASE-NAME-alfresco-search-enterprise-es
key: SEARCH_USERNAME
- contains:
path: spec.template.spec.containers[0].env
content:
name: SPRING_ELASTICSEARCH_REST_PASSWORD
valueFrom:
secretKeyRef:
name: RELEASE-NAME-alfresco-search-enterprise-es
key: SEARCH_PASSWORD
- contains:
path: spec.template.spec.containers[0].env
content:
name: ALFRESCO_ACCEPTEDCONTENTMEDIATYPESCACHE_BASEURL
valueFrom:
configMapKeyRef:
name: RELEASE-NAME-alfresco-search-enterprise-ats
key: ATS_URL
- contains:
path: spec.template.spec.containers[0].env
content:
name: ALFRESCO_SHAREDFILESTORE_BASEURL
valueFrom:
configMapKeyRef:
name: RELEASE-NAME-alfresco-search-enterprise-ats
key: SFS_URL

- it: |
Render default mainfest with embedded elasticsearch and pre-existing secret
values: *testvalues
template: liveindexing-deployment.yaml
set:
elasticsearch:
enabled: true
searchIndex:
existingSecretName: nooneknows
search:
existingConfigMap:
name: escm
keys:
url: ESURL
existingSecret:
name: nooneknows
keys:
username: ESUSER
password: ESPASS
messageBroker:
existingConfigMap:
name: mymqcm
Expand All @@ -66,26 +105,30 @@ tests:
path: data.SFS_URL
value: http://sfs/alfresco/api/-default-/private/sfs/versions/1/file/
template: configmap-ats.yaml
- equal:
path: data.SPRING_ELASTICSEARCH_REST_URIS
value: http://elasticsearch-master:9200
template: configmap-elasticsearch.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: SPRING_ELASTICSEARCH_REST_URIS
valueFrom:
configMapKeyRef:
name: escm
key: ESURL
- contains:
path: spec.template.spec.containers[0].env
content:
name: SPRING_ELASTICSEARCH_REST_USERNAME
valueFrom:
secretKeyRef:
name: nooneknows
key: ELASTICSEARCH_USERNAME
key: ESUSER
- contains:
path: spec.template.spec.containers[0].env
content:
name: SPRING_ELASTICSEARCH_REST_PASSWORD
valueFrom:
secretKeyRef:
name: nooneknows
key: ELASTICSEARCH_PASSWORD
key: ESPASS
- equal:
path: spec.template.spec.containers[0].resources
value:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ tests:
name: SPRING_ELASTICSEARCH_REST_USERNAME
valueFrom:
secretKeyRef:
name: RELEASE-NAME-alfresco-search-enterprise-elasticsearch-secret
key: ELASTICSEARCH_USERNAME
name: RELEASE-NAME-alfresco-search-enterprise-es
key: SEARCH_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
name: RELEASE-NAME-alfresco-search-enterprise-es
key: SEARCH_PASSWORD

- it: should not be present when disabled
set:
Expand Down
Loading