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-2836 Allow setting environment variables for each component #366

Merged
merged 7 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
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.0
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.0](https://img.shields.io/badge/Version-4.0.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)
![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,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:
gionn marked this conversation as resolved.
Show resolved Hide resolved
{{- 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 := deepCopy $.Values.liveIndexing.environment | mustMerge (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 := 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 @@ -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,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: liveindexing-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
Loading