Skip to content

Commit

Permalink
Allow setting environment variables for each component
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Sep 19, 2024
1 parent bf048ce commit 536b3de
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 10 deletions.
6 changes: 6 additions & 0 deletions charts/alfresco-search-enterprise/README.md
Original file line number Diff line number Diff line change
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,14 @@ 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: "{{ index $.Values "liveIndexing" $serviceName "image" "repository" }}:\
{{ index $.Values "liveIndexing" $serviceName "image" "tag" }}"
imagePullPolicy: {{ index $.Values "liveIndexing" $serviceName "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 +52,7 @@ spec:
configMapKeyRef:
name: {{ $ats_cm }}
key: {{ $.Values.ats.existingConfigMap.keys.sfs_url }}
{{- range $key, $val := $.Values.liveIndexing.environment }}
{{- range $key, $val := merge $.Values.liveIndexing.environment (index $.Values "liveIndexing" $serviceName "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 := (merge .Values.liveIndexing.environment .Values.liveIndexing.mediation.environment) }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ 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
set:
Expand Down Expand Up @@ -329,3 +329,26 @@ 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: liveindexing-deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: CUSTOM_ENV
value: custom_value
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,26 @@ 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:
key1: value1
key2: value2
mediation:
environment:
key3: value3
key4: value4
asserts:
- lengthEqual:
path: spec.template.spec.containers[0].env
count: 15
template: statefulset-mediation.yaml
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 536b3de

Please sign in to comment.