Skip to content

Commit

Permalink
OPSEXP-2836 [search enterprise] Allow setting environment variables f…
Browse files Browse the repository at this point in the history
…or each component (#366)
  • Loading branch information
gionn authored Sep 24, 2024
1 parent ba5d02c commit 797aea8
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 19 deletions.
2 changes: 1 addition & 1 deletion 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: 4.0.1
version: 4.1.0
appVersion: 4.1.0
dependencies:
- name: alfresco-common
Expand Down
8 changes: 7 additions & 1 deletion charts/alfresco-search-enterprise/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ parent: Charts Reference

# alfresco-search-enterprise

![Version: 4.0.1](https://img.shields.io/badge/Version-4.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.1.0](https://img.shields.io/badge/AppVersion-4.1.0-informational?style=flat-square)
![Version: 4.1.0](https://img.shields.io/badge/Version-4.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.1.0](https://img.shields.io/badge/AppVersion-4.1.0-informational?style=flat-square)

A Helm chart for deploying Alfresco Elasticsearch connector

Expand Down Expand Up @@ -36,21 +36,26 @@ Checkout [alfresco-content-services chart's doc](https://github.com/Alfresco/acs
| indexName | string | `"alfresco"` | Name of the existing search index, usually created by repo |
| liveIndexing.content.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0] | object | `{"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["{{ template \"alfresco-search-enterprise.content.name\" $ }}"]},{"key":"app.kubernetes.io/instance","operator":"In","values":["{{ $.Release.Name }}"]},{"key":"app.kubernetes.io/component","operator":"In","values":["{{ $.Chart.Name }}"]}]},"topologyKey":"topology.kubernetes.io/zone"},"weight":10}` | Prefer to schedule the content pod on a different zone |
| liveIndexing.content.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[1] | object | `{"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["{{ template \"alfresco-search-enterprise.content.name\" $ }}"]},{"key":"app.kubernetes.io/instance","operator":"In","values":["{{ $.Release.Name }}"]},{"key":"app.kubernetes.io/component","operator":"In","values":["{{ $.Chart.Name }}"]}]},"topologyKey":"kubernetes.io/hostname"},"weight":5}` | Prefer to schedule the content pod on a different node |
| liveIndexing.content.environment | object | `{}` | Set environment variables for the content component |
| liveIndexing.content.image.pullPolicy | string | `"IfNotPresent"` | |
| liveIndexing.content.image.repository | string | `"quay.io/alfresco/alfresco-elasticsearch-live-indexing-content"` | |
| liveIndexing.content.image.tag | string | `"4.1.0"` | |
| liveIndexing.content.replicaCount | int | `1` | |
| liveIndexing.environment | object | `{}` | Set environment variables for all the live indexing components (mediation, content, metadata, path) |
| liveIndexing.mediation.environment | object | `{}` | Set environment variables for the mediation component |
| liveIndexing.mediation.image.pullPolicy | string | `"IfNotPresent"` | |
| liveIndexing.mediation.image.repository | string | `"quay.io/alfresco/alfresco-elasticsearch-live-indexing-mediation"` | |
| liveIndexing.mediation.image.tag | string | `"4.1.0"` | |
| liveIndexing.metadata.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0] | object | `{"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["{{ template \"alfresco-search-enterprise.metadata.name\" $ }}"]},{"key":"app.kubernetes.io/instance","operator":"In","values":["{{ $.Release.Name }}"]},{"key":"app.kubernetes.io/component","operator":"In","values":["{{ $.Chart.Name }}"]}]},"topologyKey":"topology.kubernetes.io/zone"},"weight":10}` | Prefer to schedule the content pod on a different zone |
| liveIndexing.metadata.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[1] | object | `{"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["{{ template \"alfresco-search-enterprise.metadata.name\" $ }}"]},{"key":"app.kubernetes.io/instance","operator":"In","values":["{{ $.Release.Name }}"]},{"key":"app.kubernetes.io/component","operator":"In","values":["{{ $.Chart.Name }}"]}]},"topologyKey":"kubernetes.io/hostname"},"weight":5}` | Prefer to schedule the content pod on a different node |
| liveIndexing.metadata.environment | object | `{}` | Set environment variables for the metadata component |
| liveIndexing.metadata.image.pullPolicy | string | `"IfNotPresent"` | |
| liveIndexing.metadata.image.repository | string | `"quay.io/alfresco/alfresco-elasticsearch-live-indexing-metadata"` | |
| liveIndexing.metadata.image.tag | string | `"4.1.0"` | |
| liveIndexing.metadata.replicaCount | int | `1` | |
| liveIndexing.path.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0] | object | `{"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["{{ template \"alfresco-search-enterprise.path.name\" $ }}"]},{"key":"app.kubernetes.io/instance","operator":"In","values":["{{ $.Release.Name }}"]},{"key":"app.kubernetes.io/component","operator":"In","values":["{{ $.Chart.Name }}"]}]},"topologyKey":"topology.kubernetes.io/zone"},"weight":10}` | Prefer to schedule the content pod on a different zone |
| liveIndexing.path.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[1] | object | `{"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["{{ template \"alfresco-search-enterprise.path.name\" $ }}"]},{"key":"app.kubernetes.io/instance","operator":"In","values":["{{ $.Release.Name }}"]},{"key":"app.kubernetes.io/component","operator":"In","values":["{{ $.Chart.Name }}"]}]},"topologyKey":"kubernetes.io/hostname"},"weight":5}` | Prefer to schedule the content pod on a different node |
| liveIndexing.path.environment | object | `{}` | Set environment variables for the path component |
| liveIndexing.path.image.pullPolicy | string | `"IfNotPresent"` | |
| liveIndexing.path.image.repository | string | `"quay.io/alfresco/alfresco-elasticsearch-live-indexing-path"` | |
| liveIndexing.path.image.tag | string | `"4.1.0"` | |
Expand All @@ -75,6 +80,7 @@ Checkout [alfresco-content-services chart's doc](https://github.com/Alfresco/acs
| reindexing.db.url | string | `nil` | Provide the full JDBC url to connect to database service e.g.: `jdbc:postgresql://hostname:5432/database` |
| reindexing.db.username | string | `nil` | The username required to access the service |
| reindexing.enabled | bool | `true` | Create the one-shot job to trigger the reindexing of repo contents |
| reindexing.environment | object | `{}` | |
| reindexing.image.pullPolicy | string | `"IfNotPresent"` | |
| reindexing.image.repository | string | `"quay.io/alfresco/alfresco-elasticsearch-reindexing"` | |
| reindexing.image.tag | string | `"4.1.0"` | |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- range $serviceName, $service := omit .Values.liveIndexing "mediation" }}
{{- range $serviceName := list "content" "metadata" "path" }}
{{- $service := index $.Values.liveIndexing $serviceName }}
---
apiVersion: apps/v1
kind: Deployment
Expand All @@ -24,14 +25,13 @@ spec:
{{- include (printf "alfresco-search-enterprise.%s.labels" $serviceName) $ | nindent 8 }}
spec:
serviceAccountName: {{ include "alfresco-search-enterprise.serviceAccountName" $ }}
{{- include "alfresco-common.component-pod-security-context" .Values | indent 4 }}
{{- include "alfresco-common.component-pod-security-context" $.Values | indent 4 }}
{{- include "alfresco-common.imagePullSecrets" $ | indent 6 }}
containers:
- name: {{ include (printf "alfresco-search-enterprise.%s.name" $serviceName) $ }}
image: "{{ index $.Values "liveIndexing" (printf "%s" $serviceName) "image" "repository" }}:\
{{ 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 }}
image: {{ $service.image.repository }}:{{ $service.image.tag }}
imagePullPolicy: {{ $service.image.pullPolicy }}
{{- include "alfresco-common.component-security-context" $.Values | indent 8 }}
env:
{{- include "alfresco-search-enterprise.activemq.secret.env" $ | nindent 12 }}
{{- include "alfresco-search-enterprise.activemq.cm.env" $ | nindent 12 }}
Expand All @@ -51,7 +51,7 @@ spec:
configMapKeyRef:
name: {{ $ats_cm }}
key: {{ $.Values.ats.existingConfigMap.keys.sfs_url }}
{{- range $key, $val := $.Values.liveIndexing.environment }}
{{- range $key, $val := deepCopy $.Values.liveIndexing.environment | mustMerge ($service.environment) }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
configMapKeyRef:
name: {{ $ats_cm }}
key: {{ .Values.ats.existingConfigMap.keys.transform_url }}
{{- range $key, $val := .Values.liveIndexing.environment }}
{{- range $key, $val := deepCopy .Values.liveIndexing.environment | mustMerge .Values.liveIndexing.mediation.environment }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ suite: test liveindexing template rendering
templates:
- configmap-ats.yaml
- configmap-elasticsearch.yaml
- liveindexing-deployment.yaml
- deployment.yaml
- secret-elasticsearch.yaml
- secret-database.yaml
- secret-messagebroker.yaml
Expand All @@ -13,7 +13,7 @@ tests:
using provided values and check deployment has appropriate defaults
values: &testvalues
- values/embedded-charts-values.yaml
template: liveindexing-deployment.yaml
template: deployment.yaml
asserts:
- equal:
path: data.SEARCH_URL
Expand Down Expand Up @@ -195,9 +195,9 @@ tests:
documentIndex: 2
- it: |
Render default mainfest with embedded elasticsearch and pre-existing secret
Render default manifest with embedded elasticsearch and pre-existing secret
values: *testvalues
template: liveindexing-deployment.yaml
template: deployment.yaml
set:
search:
existingConfigMap:
Expand Down Expand Up @@ -274,14 +274,14 @@ tests:
- equal:
path: spec.template.spec.nodeSelector.node_label
value: node_value
template: liveindexing-deployment.yaml
template: deployment.yaml

- it: should render labels for deployment
values: *testvalues
chart:
version: 1.0.0
appVersion: 2.0.0
template: liveindexing-deployment.yaml
template: deployment.yaml
documentIndex: 0
asserts:
- isSubset:
Expand All @@ -299,7 +299,7 @@ tests:
chart:
version: 1.0.0
appVersion: 2.0.0
template: liveindexing-deployment.yaml
template: deployment.yaml
documentIndex: 1
asserts:
- isSubset:
Expand All @@ -317,7 +317,7 @@ tests:
chart:
version: 1.0.0
appVersion: 2.0.0
template: liveindexing-deployment.yaml
template: deployment.yaml
documentIndex: 2
asserts:
- isSubset:
Expand All @@ -329,3 +329,85 @@ tests:
app.kubernetes.io/name: path
app.kubernetes.io/version: 2.0.0
helm.sh/chart: alfresco-search-enterprise-1.0.0

- it: should render custom environment variables
values: *testvalues
set:
liveIndexing:
environment:
CUSTOM_ENV: custom_value
content:
environment:
CUSTOM_CONTENT_ENV: custom_value
metadata:
environment:
CUSTOM_METADATA_ENV: custom_value
path:
environment:
CUSTOM_PATH_ENV: custom_value
template: deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_ENV
value: custom_value
# documentIndex: content (0)
- contains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_CONTENT_ENV
value: custom_value
documentIndex: 0
- notContains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_METADATA_ENV
value: custom_value
documentIndex: 0
- notContains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_PATH_ENV
value: custom_value
documentIndex: 0

# documentIndex: metadata (1)
- contains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_METADATA_ENV
value: custom_value
documentIndex: 1
- notContains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_CONTENT_ENV
value: custom_value
documentIndex: 1
- notContains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_PATH_ENV
value: custom_value
documentIndex: 1

# documentIndex: path (2)
- contains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_PATH_ENV
value: custom_value
documentIndex: 2
- notContains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_CONTENT_ENV
value: custom_value
documentIndex: 2
- notContains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_METADATA_ENV
value: custom_value
documentIndex: 2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
suite: test liveindexing template rendering
suite: mediation sts
templates:
- statefulset-mediation.yaml
- service-headless-mediation.yaml
Expand Down Expand Up @@ -45,3 +45,34 @@ tests:
app.kubernetes.io/version: 2.0.0
helm.sh/chart: alfresco-search-enterprise-1.0.0
template: statefulset-mediation.yaml

- it: should render default environment variables in statefulset
asserts:
- lengthEqual:
path: spec.template.spec.containers[0].env
count: 11
template: statefulset-mediation.yaml

- it: should render custom environment variables for statefulset
set:
liveIndexing:
environment:
CUSTOM_COMMON_ENV: custom_value
mediation:
environment:
CUSTOM_MEDIATION_ENV: custom_value
template: statefulset-mediation.yaml
asserts:
- lengthEqual:
path: spec.template.spec.containers[0].env
count: 13
- contains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_COMMON_ENV
value: custom_value
- contains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_MEDIATION_ENV
value: custom_value
11 changes: 11 additions & 0 deletions charts/alfresco-search-enterprise/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,24 @@ contentMediaTypeCache:
enabled: true
refreshTime: 0 0 * * * *
liveIndexing:
# -- Set environment variables for all the live indexing components (mediation, content, metadata, path)
environment: {}
mediation:
image:
repository: >-
quay.io/alfresco/alfresco-elasticsearch-live-indexing-mediation
tag: 4.1.0
pullPolicy: IfNotPresent
# -- Set environment variables for the mediation component
environment: {}
content:
image:
repository: quay.io/alfresco/alfresco-elasticsearch-live-indexing-content
tag: 4.1.0
pullPolicy: IfNotPresent
replicaCount: 1
# -- Set environment variables for the content component
environment: {}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down Expand Up @@ -80,6 +86,8 @@ liveIndexing:
tag: 4.1.0
pullPolicy: IfNotPresent
replicaCount: 1
# -- Set environment variables for the metadata component
environment: {}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down Expand Up @@ -127,6 +135,8 @@ liveIndexing:
tag: 4.1.0
pullPolicy: IfNotPresent
replicaCount: 1
# -- Set environment variables for the path component
environment: {}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down Expand Up @@ -176,6 +186,7 @@ reindexing:
tag: 4.1.0
pullPolicy: IfNotPresent
pathIndexingEnabled: true
environment: {}
repository:
# -- URL of the Alfresco repository
url: null
Expand Down

0 comments on commit 797aea8

Please sign in to comment.