diff --git a/charts/alfresco-search-enterprise/Chart.yaml b/charts/alfresco-search-enterprise/Chart.yaml index f7961de1..399e3b42 100644 --- a/charts/alfresco-search-enterprise/Chart.yaml +++ b/charts/alfresco-search-enterprise/Chart.yaml @@ -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 diff --git a/charts/alfresco-search-enterprise/README.md b/charts/alfresco-search-enterprise/README.md index cc893805..06fce94e 100644 --- a/charts/alfresco-search-enterprise/README.md +++ b/charts/alfresco-search-enterprise/README.md @@ -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 @@ -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"` | | @@ -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"` | | diff --git a/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml b/charts/alfresco-search-enterprise/templates/deployment.yaml similarity index 87% rename from charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml rename to charts/alfresco-search-enterprise/templates/deployment.yaml index 013a4d72..044b0937 100644 --- a/charts/alfresco-search-enterprise/templates/liveindexing-deployment.yaml +++ b/charts/alfresco-search-enterprise/templates/deployment.yaml @@ -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 @@ -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 }} @@ -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 }} diff --git a/charts/alfresco-search-enterprise/templates/statefulset-mediation.yaml b/charts/alfresco-search-enterprise/templates/statefulset-mediation.yaml index 02d36603..7e2edd77 100644 --- a/charts/alfresco-search-enterprise/templates/statefulset-mediation.yaml +++ b/charts/alfresco-search-enterprise/templates/statefulset-mediation.yaml @@ -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 }} diff --git a/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml b/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml index 9ef6fa17..8f0e6d46 100644 --- a/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml +++ b/charts/alfresco-search-enterprise/tests/liveindexing-deployment_test.yaml @@ -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 @@ -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 @@ -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: @@ -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: @@ -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: @@ -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: @@ -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 diff --git a/charts/alfresco-search-enterprise/tests/statefulset-mediation_test.yaml b/charts/alfresco-search-enterprise/tests/statefulset-mediation_test.yaml index 7174131d..51de6a26 100644 --- a/charts/alfresco-search-enterprise/tests/statefulset-mediation_test.yaml +++ b/charts/alfresco-search-enterprise/tests/statefulset-mediation_test.yaml @@ -1,5 +1,5 @@ --- -suite: test liveindexing template rendering +suite: mediation sts templates: - statefulset-mediation.yaml - service-headless-mediation.yaml @@ -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 diff --git a/charts/alfresco-search-enterprise/values.yaml b/charts/alfresco-search-enterprise/values.yaml index 61175d4f..c6de849a 100644 --- a/charts/alfresco-search-enterprise/values.yaml +++ b/charts/alfresco-search-enterprise/values.yaml @@ -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: @@ -80,6 +86,8 @@ liveIndexing: tag: 4.1.0 pullPolicy: IfNotPresent replicaCount: 1 + # -- Set environment variables for the metadata component + environment: {} affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: @@ -127,6 +135,8 @@ liveIndexing: tag: 4.1.0 pullPolicy: IfNotPresent replicaCount: 1 + # -- Set environment variables for the path component + environment: {} affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: @@ -176,6 +186,7 @@ reindexing: tag: 4.1.0 pullPolicy: IfNotPresent pathIndexingEnabled: true + environment: {} repository: # -- URL of the Alfresco repository url: null