From c18bfc3f796d6ff95a1e52717a0d9a951445e4a3 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo <71768+gionn@users.noreply.github.com> Date: Fri, 12 Jan 2024 10:08:57 +0100 Subject: [PATCH] OPSEXP-2291 Bump Search services chart to most recent conventions (#179) --- charts/alfresco-search-service/Chart.lock | 8 +- charts/alfresco-search-service/Chart.yaml | 6 +- charts/alfresco-search-service/README.md | 37 ++++++--- .../alfresco-search-service/README.md.gotmpl | 2 +- .../alfresco-insight-zeppelin/Chart.lock | 6 +- .../alfresco-insight-zeppelin/Chart.yaml | 4 +- .../alfresco-insight-zeppelin/README.md | 17 +++- .../README.md.gotmpl | 2 +- .../templates/_helpers-name.tpl | 4 + .../templates/_helpers.tpl | 68 ++++++++++++---- .../templates/config.yaml | 20 +++-- .../templates/deployment.yaml | 72 ++++++++++++----- .../templates/ingress.yaml | 11 +-- .../templates/service.yaml | 12 +-- .../templates/serviceAccount.yaml | 13 +++ .../tests/config_test.yaml | 7 +- .../tests/deployment_test.yaml | 4 +- .../alfresco-insight-zeppelin/values.yaml | 33 +++++++- .../ci/default-values.yaml | 1 + .../templates/_helpers-misc.tpl | 44 +++++++++++ .../templates/_helpers-name.tpl | 19 +++++ .../templates/_helpers.tpl | 52 ------------ .../templates/config.yaml | 17 ++-- .../templates/deployment.yaml | 79 +++++++++---------- .../templates/ingress.yaml | 20 ++--- .../templates/pvc.yaml | 50 +----------- .../templates/secret-ingress.yaml | 5 +- .../templates/secret-repository.yaml | 13 ++- .../templates/service.yaml | 11 +-- .../templates/serviceAccount.yaml | 13 +++ .../tests/config_test.yaml | 6 +- .../tests/deployment_test.yaml | 59 +++++++++++++- .../tests/ingress_test.yaml | 31 ++++---- .../tests/resources_test.yaml | 26 ------ .../tests/secret-ingress_test.yaml | 33 ++++++++ .../tests/secret-repository_test.yaml | 32 ++++++++ .../tests/secrets_test.yaml | 66 ---------------- .../{ingress.yaml => ingress_enabled.yaml} | 0 .../tests/values/test_values.yaml | 2 + charts/alfresco-search-service/values.yaml | 55 +++++++++---- 40 files changed, 545 insertions(+), 415 deletions(-) create mode 100644 charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/_helpers-name.tpl create mode 100644 charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/serviceAccount.yaml create mode 100644 charts/alfresco-search-service/templates/_helpers-misc.tpl create mode 100644 charts/alfresco-search-service/templates/_helpers-name.tpl create mode 100644 charts/alfresco-search-service/templates/serviceAccount.yaml delete mode 100644 charts/alfresco-search-service/tests/resources_test.yaml create mode 100644 charts/alfresco-search-service/tests/secret-ingress_test.yaml create mode 100644 charts/alfresco-search-service/tests/secret-repository_test.yaml delete mode 100644 charts/alfresco-search-service/tests/secrets_test.yaml rename charts/alfresco-search-service/tests/values/{ingress.yaml => ingress_enabled.yaml} (100%) diff --git a/charts/alfresco-search-service/Chart.lock b/charts/alfresco-search-service/Chart.lock index 4abd6842..6c6b3488 100644 --- a/charts/alfresco-search-service/Chart.lock +++ b/charts/alfresco-search-service/Chart.lock @@ -1,9 +1,9 @@ dependencies: - name: alfresco-insight-zeppelin repository: "" - version: 2.2.0 + version: 3.0.0-alpha.0 - name: alfresco-common repository: https://alfresco.github.io/alfresco-helm-charts/ - version: 2.1.0 -digest: sha256:d936b2a9611e46791878d3a7ead2d61fc97e65e343955aeb247b4709f124a725 -generated: "2023-09-13T17:05:38.325916+02:00" + version: 3.1.0 +digest: sha256:611a989ecff183861c046d6090836371cac0abb9fee3e05278d239769a568cbc +generated: "2024-01-08T17:15:25.064429+01:00" diff --git a/charts/alfresco-search-service/Chart.yaml b/charts/alfresco-search-service/Chart.yaml index c63a4074..a070df3f 100644 --- a/charts/alfresco-search-service/Chart.yaml +++ b/charts/alfresco-search-service/Chart.yaml @@ -15,12 +15,12 @@ keywords: name: alfresco-search-service sources: - https://github.com/Alfresco/alfresco-helm-charts -version: 2.1.0 +version: 3.0.0-alpha.0 appVersion: 2.0.8.2 dependencies: - name: alfresco-insight-zeppelin - version: 2.2.0 + version: 3.0.0-alpha.0 condition: alfresco-insight-zeppelin.enabled - name: alfresco-common - version: 2.1.0 + version: 3.1.0 repository: https://alfresco.github.io/alfresco-helm-charts/ diff --git a/charts/alfresco-search-service/README.md b/charts/alfresco-search-service/README.md index 36aca320..49ae726f 100644 --- a/charts/alfresco-search-service/README.md +++ b/charts/alfresco-search-service/README.md @@ -1,10 +1,10 @@ # alfresco-search-service -![Version: 2.1.0](https://img.shields.io/badge/Version-2.1.0-informational?style=flat-square) ![AppVersion: 2.0.8.2](https://img.shields.io/badge/AppVersion-2.0.8.2-informational?style=flat-square) +![Version: 3.0.0-alpha.0](https://img.shields.io/badge/Version-3.0.0--alpha.0-informational?style=flat-square) ![AppVersion: 2.0.8.2](https://img.shields.io/badge/AppVersion-2.0.8.2-informational?style=flat-square) A Helm chart for deploying Alfresco Search Service -Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/blob/master/docs/helm/README.md) for information on the Helm charts and deployment instructions. +Checkout [alfresco-content-services chart's doc](https://github.com/Alfresco/acs-deployment/blob/master/docs/helm/README.md) for an example of how to leverage this chart from an umbrella chart. **Homepage:** @@ -16,13 +16,14 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b | Repository | Name | Version | |------------|------|---------| -| | alfresco-insight-zeppelin | 2.2.0 | -| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 2.1.0 | +| | alfresco-insight-zeppelin | 3.0.0-alpha.0 | +| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.1.0 | ## Values | Key | Type | Default | Description | |-----|------|---------|-------------| +| affinity | string | `""` | Pod affinity, passed thru tpl function | | alfresco-insight-zeppelin.enabled | bool | `false` | | | environment.SOLR_CREATE_ALFRESCO_DEFAULTS | string | `"alfresco,archive"` | | | global.alfrescoRegistryPullSecrets | string | `"quay-registry-secret"` | | @@ -44,10 +45,14 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b | livenessProbe.initialDelaySeconds | int | `130` | | | livenessProbe.periodSeconds | int | `20` | | | livenessProbe.timeoutSeconds | int | `10` | | -| nodeSelector | object | `{}` | Define the alfresco-search properties to use in the k8s cluster This is the search provider used by alfresco-content-repository | -| persistence | object | `{"EbsPvConfiguration":{"fsType":"ext4"},"VolumeSizeRequest":"10Gi","enabled":true,"search":{"data":{"mountPath":"/opt/alfresco-search-services/data","subPath":"alfresco-content-services/solr-data"}}}` | Defines the persistence | -| persistence.VolumeSizeRequest | string | `"10Gi"` | Only define if you have a specific claim already created existingClaim: "search-master-claim" | -| persistence.enabled | bool | `true` | If set to false data will be lost with pods | +| nodeSelector | object | `{}` | | +| persistence.accessModes[0] | string | `"ReadWriteOnce"` | | +| persistence.baseSize | string | `"10Gi"` | Capacity of the PVC for persistency | +| persistence.enabled | bool | `true` | When disabled, data is lost when pod is terminated/rescheduled | +| persistence.existingClaim | string | `nil` | Provide a pre-existing PVC for persistency | +| persistence.search.data.mountPath | string | `"/opt/alfresco-search-services/data"` | | +| persistence.search.data.subPath | string | `"alfresco-content-services/solr-data"` | | +| persistence.storageClass | string | `nil` | Bind PVC based on storageClass (e.g. dynamic provisioning) | | podSecurityContext.fsGroup | int | `33007` | | | podSecurityContext.runAsGroup | int | `33007` | | | podSecurityContext.runAsNonRoot | bool | `true` | | @@ -58,12 +63,13 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b | repository.existingConfigMap.keys.host | string | `"SOLR_ALFRESCO_HOST"` | Key within the configmap holding the repository hostname | | repository.existingConfigMap.keys.port | string | `"SOLR_ALFRESCO_PORT"` | Key within the configmap holding the repository port | | repository.existingConfigMap.keys.securecomms | string | `"SOLR_ALFRESCO_SECURE_COMMS"` | Key within the configmap holding the repository security level | -| repository.existingConfigMap.name | string | `nil` | Name of a pre-existing configmap containing Alfresco repository URL In addition to tjhe keys mentionned bellow the configMap may contain any solr property translated as an env variable (e.g SOLR_ALFRESCO_BASEURL). | +| repository.existingConfigMap.name | string | `nil` | Name of a pre-existing configmap containing Alfresco repository URL | | repository.existingSecret.keys.sharedSecret | string | `"SOLR_ALFRESCO_SECURECOMMS_SECRET"` | Key within the secret holding the repository shared secret | -| repository.existingSecret.name | string | `nil` | Name of a pre-existing secret containing message broker credentials | -| repository.securecomms | string | `"secret"` | repository security level to use when tracking the repo ('none' or 'secret') | -| repository.sharedSecret | string | `nil` | Secret shared with the repository when securecomms is set to 'secret' | -| repository.url | string | `"http://alfresco-search-service/solr"` | Alfresco repository URL | +| repository.existingSecret.name | string | `nil` | Alternatively, provide a pre-existing secret containing the shared secret used with repository when `securecomms` is `secret` | +| repository.host | string | `nil` | Alfresco repository hostname | +| repository.port | string | `nil` | Alfresco repository port | +| repository.securecomms | string | `"secret"` | Alfresco repository security level to use when tracking the repo ('none' or 'secret') | +| repository.sharedSecret | string | `nil` | Shared secret used with repository when `securecomms` is `secret` | | resources.limits.cpu | string | `"4"` | | | resources.limits.memory | string | `"2000Mi"` | | | resources.requests.cpu | string | `"0.50"` | | @@ -74,4 +80,9 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b | searchServicesImage.tag | string | `"2.0.8.2"` | | | service.name | string | `"solr"` | | | service.type | string | `"ClusterIP"` | | +| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | +| serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials? | +| serviceAccount.create | bool | `true` | Specifies whether a service account should be created | +| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | +| tolerations | list | `[]` | | | type | string | `"search-services"` | set alfresco-insight-zeppelin.enabled=true As the Docker Image for Insight Engine is not publicly available the alfrescoRegistryPullSecrets has to be set More information can be found on https://github.com/Alfresco/acs-deployment/blob/master/docs/helm/registry-authentication.md | diff --git a/charts/alfresco-search-service/README.md.gotmpl b/charts/alfresco-search-service/README.md.gotmpl index b301f393..0ad8b9e6 100644 --- a/charts/alfresco-search-service/README.md.gotmpl +++ b/charts/alfresco-search-service/README.md.gotmpl @@ -5,7 +5,7 @@ {{ template "chart.description" . }} -Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/blob/master/docs/helm/README.md) for information on the Helm charts and deployment instructions. +Checkout [alfresco-content-services chart's doc](https://github.com/Alfresco/acs-deployment/blob/master/docs/helm/README.md) for an example of how to leverage this chart from an umbrella chart. {{ template "chart.homepageLine" . }} diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.lock b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.lock index 38eaebe7..be2812a0 100644 --- a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.lock +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: alfresco-common repository: https://alfresco.github.io/alfresco-helm-charts/ - version: 2.1.0 -digest: sha256:fa11b87976e8340dfe349a0bc7d672c197decf3303de5bbe102c19f6216690fa -generated: "2023-08-18T17:03:16.720641+02:00" + version: 3.1.0 +digest: sha256:9c28428c3dce7c46decd859744075a51482adc21b4c21427840695fcaa23039d +generated: "2024-01-05T16:35:03.929458+01:00" diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.yaml b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.yaml index 9d372c17..fde91210 100644 --- a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.yaml +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.yaml @@ -8,11 +8,11 @@ keywords: - alfresco zeppelin - alfresco insight zeppelin name: alfresco-insight-zeppelin -version: 2.2.0 +version: 3.0.0-alpha.0 sources: - https://github.com/Alfresco/alfresco-helm-charts appVersion: 2.0.8 dependencies: - name: alfresco-common - version: 2.1.0 + version: 3.1.0 repository: https://alfresco.github.io/alfresco-helm-charts/ diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md index c6d47af6..2b05beae 100644 --- a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md @@ -1,10 +1,10 @@ # alfresco-insight-zeppelin -![Version: 2.2.0](https://img.shields.io/badge/Version-2.2.0-informational?style=flat-square) ![AppVersion: 2.0.8](https://img.shields.io/badge/AppVersion-2.0.8-informational?style=flat-square) +![Version: 3.0.0-alpha.0](https://img.shields.io/badge/Version-3.0.0--alpha.0-informational?style=flat-square) ![AppVersion: 2.0.8](https://img.shields.io/badge/AppVersion-2.0.8-informational?style=flat-square) A Helm chart for deploying Alfresco Insight Zeppelin -Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/blob/master/docs/helm/README.md) for information on the Helm charts and deployment instructions. +Checkout [alfresco-content-services chart's doc](https://github.com/Alfresco/acs-deployment/blob/master/docs/helm/README.md) for an example of how to leverage this chart from an umbrella chart. **Homepage:** @@ -16,12 +16,13 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b | Repository | Name | Version | |------------|------|---------| -| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 2.1.0 | +| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.1.0 | ## Values | Key | Type | Default | Description | |-----|------|---------|-------------| +| affinity | string | `""` | Pod affinity, passed thru tpl function | | environment.ZEPPELIN_INTP_MEM | string | `"-Xms512m -Xmx1g"` | | | environment.ZEPPELIN_MEM | string | `"-Xms512m -Xmx1g"` | | | global.alfrescoRegistryPullSecrets | string | `"quay-registry-secret"` | Global definition of Docker registry pull secret which can be overridden from parent ACS Helm chart(s) | @@ -42,7 +43,10 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b | readinessProbe.periodSeconds | int | `20` | | | readinessProbe.timeoutSeconds | int | `10` | | | replicaCount | int | `1` | | -| repository | object | `{}` | The parent chart will set the values for "repository.host" and "repository.port" | +| repository.existingConfigMap.keys.host | string | `"REPO_HOST"` | Key within the configmap holding the repository hostname | +| repository.existingConfigMap.keys.port | string | `"REPO_PORT"` | Key within the configmap holding the repository port | +| repository.existingConfigMap.name | string | `nil` | Name of a pre-existing configmap containing Alfresco repository URL | +| repository.url | string | `"http://alfresco-search-service"` | Alfresco repository URL | | resources.limits.cpu | string | `"1"` | | | resources.limits.memory | string | `"1024Mi"` | | | resources.requests.cpu | string | `"0.5"` | | @@ -50,3 +54,8 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b | service.externalPort | int | `80` | | | service.name | string | `"zeppelin"` | | | service.type | string | `"ClusterIP"` | | +| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | +| serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials? | +| serviceAccount.create | bool | `true` | Specifies whether a service account should be created | +| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | +| tolerations | list | `[]` | | diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md.gotmpl b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md.gotmpl index b301f393..0ad8b9e6 100644 --- a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md.gotmpl +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md.gotmpl @@ -5,7 +5,7 @@ {{ template "chart.description" . }} -Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/blob/master/docs/helm/README.md) for information on the Helm charts and deployment instructions. +Checkout [alfresco-content-services chart's doc](https://github.com/Alfresco/acs-deployment/blob/master/docs/helm/README.md) for an example of how to leverage this chart from an umbrella chart. {{ template "chart.homepageLine" . }} diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/_helpers-name.tpl b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/_helpers-name.tpl new file mode 100644 index 00000000..ce1402ea --- /dev/null +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/_helpers-name.tpl @@ -0,0 +1,4 @@ +{{- define "alfresco-insight-zeppelin.deployment.name" -}} +{{- $scope := (dict "Values" (dict "nameOverride" "insight-zeppelin" ) "Chart" .Chart "Release" .Release) }} +{{- include "alfresco-insight-zeppelin.fullname" $scope }} +{{- end }} diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/_helpers.tpl b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/_helpers.tpl index afbaf814..5e693aec 100644 --- a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/_helpers.tpl +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/_helpers.tpl @@ -1,28 +1,62 @@ {{/* -Get Alfresco Insight Zeppelin Full Name +Expand the name of the chart. */}} -{{- define "alfresco-insight-zeppelin.fullName" -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} +{{- define "alfresco-insight-zeppelin.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} {{/* -Get Alfresco Zeppelin Host +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. */}} -{{- define "alfresco-insight-zeppelin.host" -}} -{{- printf "%s-%s" .Release.Name "alfresco-insight-zeppelin" -}} -{{- end -}} +{{- define "alfresco-insight-zeppelin.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} {{/* -Get Alfresco Repo Host +Create chart name and version as used by the chart label. */}} -{{- define "alfresco-repo-host" -}} -{{- .Values.repository.host | default (printf "%s-repository" (include "content-services.shortname" $)) }} -{{- end -}} +{{- define "alfresco-insight-zeppelin.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} {{/* -Get Alfresco Repo Port +Common labels */}} -{{- define "alfresco-repo-port" -}} -{{- .Values.repository.port | default 80 }} -{{- end -}} +{{- define "alfresco-insight-zeppelin.labels" -}} +helm.sh/chart: {{ include "alfresco-insight-zeppelin.chart" . }} +{{ include "alfresco-insight-zeppelin.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "alfresco-insight-zeppelin.selectorLabels" -}} +app.kubernetes.io/name: {{ include "alfresco-insight-zeppelin.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "alfresco-insight-zeppelin.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "alfresco-insight-zeppelin.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/config.yaml b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/config.yaml index ef73c5d8..d68625d6 100644 --- a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/config.yaml +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/config.yaml @@ -1,17 +1,15 @@ ---- -# Defines the config for the Alfresco Insight Zeppelin App +{{- if not .Values.repository.existingConfigMap.name }} apiVersion: v1 kind: ConfigMap metadata: - name: {{ template "alfresco-insight-zeppelin.fullName" . }}-configmap + name: {{ template "alfresco-insight-zeppelin.deployment.name" . }} labels: - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - component: zeppelin + {{- include "alfresco-insight-zeppelin.labels" . | nindent 4 }} data: - REPO_HOST: "{{ template "alfresco-repo-host" . }}" - REPO_PORT: "{{ template "alfresco-repo-port" . }}" - {{- range $key, $value := .Values.environment }} - {{ $key }}: {{ $value }} + {{- with .Values.repository }} + REPO_HOST: >- + {{ template "alfresco-common.url.host" .url }} + REPO_PORT: >- + {{ template "alfresco-common.url.port" .url }} {{- end }} +{{- end }} diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/deployment.yaml b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/deployment.yaml index 952811c7..b98b7f12 100644 --- a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/deployment.yaml +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/deployment.yaml @@ -3,44 +3,55 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ template "alfresco-insight-zeppelin.fullName" . }} + name: {{ template "alfresco-insight-zeppelin.deployment.name" . }} labels: - app: {{ template "alfresco-insight-zeppelin.fullName" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - component: zeppelin + {{- include "alfresco-insight-zeppelin.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: - app: {{ template "alfresco-insight-zeppelin.fullName" . }} - release: {{ .Release.Name }} + {{- include "alfresco-insight-zeppelin.selectorLabels" . | nindent 6 }} strategy: type: RollingUpdate rollingUpdate: {{- toYaml .Values.global.strategy.rollingUpdate | nindent 6 }} template: metadata: annotations: - checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} labels: - app: {{ template "alfresco-insight-zeppelin.fullName" . }} - release: {{ .Release.Name }} + {{- include "alfresco-insight-zeppelin.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} spec: - {{- include "component-pod-security-context" .Values | indent 4 }} - {{- if .Values.nodeSelector }} - nodeSelector: {{- .Values.nodeSelector | toYaml | nindent 8 }} - {{- end }} {{- include "alfresco-content-services.imagePullSecrets" . | indent 6 }} + serviceAccountName: {{ include "alfresco-insight-zeppelin.serviceAccountName" . }} + {{- include "alfresco-common.component-pod-security-context" .Values | indent 4 }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} - resources: {{- toYaml .Values.resources | nindent 12 }} - {{- include "component-security-context" .Values | indent 8 }} - envFrom: - - configMapRef: - name: {{ template "alfresco-insight-zeppelin.fullName" . }}-configmap + {{- include "alfresco-common.component-security-context" .Values | indent 8 }} + env: + {{- with .Values.repository }} + - name: REPO_HOST + valueFrom: + configMapKeyRef: + name: {{ template "alfresco-insight-zeppelin.deployment.name" $ }} + key: {{ .existingConfigMap.keys.host }} + - name: REPO_PORT + valueFrom: + configMapKeyRef: + name: {{ template "alfresco-insight-zeppelin.deployment.name" $ }} + key: {{ .existingConfigMap.keys.port }} + {{- end }} + {{- $environment := .Values.environment | default dict }} + {{- range $key, $val := $environment }} + - name: {{ $key }} + value: {{ $val | quote }} + {{- end }} ports: - containerPort: {{ .Values.image.internalPort }} readinessProbe: @@ -56,3 +67,24 @@ spec: port: {{ .Values.image.internalPort }} initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- tpl . $ | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/ingress.yaml b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/ingress.yaml index 48a7d6ac..37875826 100644 --- a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/ingress.yaml +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/ingress.yaml @@ -1,12 +1,13 @@ -{{- $serviceName := (include "alfresco-insight-zeppelin.fullName" .) -}} +{{- $serviceName := (include "alfresco-insight-zeppelin.fullname" .) -}} {{- $servicePort := .Values.service.externalPort -}} -apiVersion: {{ template "common.capabilities.ingress.apiVersion" . }} +apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: {{ template "alfresco-insight-zeppelin.fullName" . }} - annotations: - kubernetes.io/ingress.class: "nginx" + name: {{ template "alfresco-insight-zeppelin.fullname" . }} + labels: + {{- include "alfresco-insight-zeppelin.labels" . | nindent 4 }} spec: + ingressClassName: nginx rules: - http: paths: diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/service.yaml b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/service.yaml index f69bc5b1..5e6ee149 100644 --- a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/service.yaml +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/service.yaml @@ -1,14 +1,9 @@ ---- -# Defines the service for the Alfresco Insight Zeppelin App apiVersion: v1 kind: Service metadata: - name: {{ template "alfresco-insight-zeppelin.fullName" . }} + name: {{ template "alfresco-insight-zeppelin.deployment.name" . }} labels: - app: {{ template "alfresco-insight-zeppelin.fullName" . }}-app - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + {{- include "alfresco-insight-zeppelin.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: @@ -16,5 +11,4 @@ spec: targetPort: {{ .Values.image.internalPort }} name: {{ .Values.service.name }} selector: - app: {{ template "alfresco-insight-zeppelin.fullName" . }} - release: {{ .Release.Name }} + {{- include "alfresco-insight-zeppelin.selectorLabels" . | nindent 4 }} diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/serviceAccount.yaml b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/serviceAccount.yaml new file mode 100644 index 00000000..5469b675 --- /dev/null +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/serviceAccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "alfresco-insight-zeppelin.serviceAccountName" . }} + labels: + {{- include "alfresco-insight-zeppelin.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/config_test.yaml b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/config_test.yaml index cc6efd0e..b0884d10 100644 --- a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/config_test.yaml +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/config_test.yaml @@ -1,5 +1,5 @@ --- -suite: test configmaps +suite: test zeppelin configmap templates: - config.yaml tests: @@ -7,7 +7,7 @@ tests: asserts: - equal: path: data.REPO_HOST - value: RELEASE-NAME-alfresco-cs-repository + value: alfresco-search-service template: config.yaml - equal: path: data.REPO_PORT @@ -17,8 +17,7 @@ tests: - it: should have provided host and port set: repository: - host: somacshost - port: 888 + url: https://somacshost:888 asserts: - equal: path: data.REPO_HOST diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/deployment_test.yaml b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/deployment_test.yaml index 05e6cea1..95befd14 100644 --- a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/deployment_test.yaml +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/deployment_test.yaml @@ -1,5 +1,5 @@ --- -suite: test deployment +suite: test zeppelin deployment templates: - deployment.yaml - config.yaml @@ -8,7 +8,7 @@ tests: asserts: - equal: path: metadata.name - value: RELEASE-NAME-alfresco-insight-zeppelin + value: RELEASE-NAME-insight-zeppelin template: deployment.yaml - it: should render cpu and memory limits diff --git a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/values.yaml b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/values.yaml index 70b83caf..f815cfaa 100644 --- a/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/values.yaml +++ b/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/values.yaml @@ -1,6 +1,5 @@ --- replicaCount: 1 -nodeSelector: {} image: repository: quay.io/alfresco/insight-zeppelin tag: 2.0.8 @@ -15,9 +14,19 @@ service: externalPort: 80 ingress: path: /zeppelin -# -- The parent chart will set the values for "repository.host" and -# "repository.port" -repository: {} + +repository: + # -- Alfresco repository URL + url: http://alfresco-search-service + existingConfigMap: + # -- Name of a pre-existing configmap containing Alfresco repository URL + name: null + keys: + # -- Key within the configmap holding the repository hostname + host: REPO_HOST + # -- Key within the configmap holding the repository port + port: REPO_PORT + resources: requests: cpu: "0.5" @@ -44,3 +53,19 @@ global: rollingUpdate: maxSurge: 1 maxUnavailable: 0 + +nodeSelector: {} +tolerations: [] +# -- Pod affinity, passed thru tpl function +affinity: |- + +serviceAccount: + # -- Specifies whether a service account should be created + create: true + # -- Automatically mount a ServiceAccount's API credentials? + automount: true + # -- Annotations to add to the service account + annotations: {} + # -- The name of the service account to use. If not set and create is true, a + # name is generated using the fullname template + name: "" diff --git a/charts/alfresco-search-service/ci/default-values.yaml b/charts/alfresco-search-service/ci/default-values.yaml index 2e0fdc99..94e43d33 100644 --- a/charts/alfresco-search-service/ci/default-values.yaml +++ b/charts/alfresco-search-service/ci/default-values.yaml @@ -4,3 +4,4 @@ alfresco-insight-zeppelin: enabled: true repository: sharedSecret: dummy + url: http://alfresco-search-service/solr diff --git a/charts/alfresco-search-service/templates/_helpers-misc.tpl b/charts/alfresco-search-service/templates/_helpers-misc.tpl new file mode 100644 index 00000000..174b212a --- /dev/null +++ b/charts/alfresco-search-service/templates/_helpers-misc.tpl @@ -0,0 +1,44 @@ +{{/* +Get Alfresco Search container Port ("internal") +*/}} +{{- define "alfresco-search.containerPort" -}} +{{- if and (.Values.type) (eq (.Values.type | toString) "insight-engine") }} +{{- .Values.insightEngineImage.internalPort | default 8983 | int -}} +{{- else }} +{{- .Values.searchServicesImage.internalPort | default 8983 | int -}} +{{- end }} +{{- end -}} + +{{/* +Get Alfresco Search Service Port +*/}} +{{- define "alfresco-search.svcPort" -}} +{{- $defaultSvcPort := 80 }} +{{- if hasKey .Values "service" }} + {{- coalesce .Values.service.externalPort $defaultSvcPort | int }} +{{- else }} + {{- $defaultSvcPort | int }} +{{- end }} +{{- end -}} + +{{/* +Get Alfresco Search Pull Policy +*/}} +{{- define "alfresco-search.pullPolicy" -}} +{{- if and (.Values.type) (eq (.Values.type | toString) "insight-engine") }} +{{- print .Values.insightEngineImage.pullPolicy -}} +{{- else }} +{{- print .Values.searchServicesImage.pullPolicy -}} +{{- end }} +{{- end -}} + +{{/* +Get Alfresco Search Docker Image +*/}} +{{- define "alfresco-search.dockerImage" -}} +{{- if and (.Values.type) (eq (.Values.type | toString) "insight-engine") }} + {{- printf "%s:%s" .Values.insightEngineImage.repository .Values.insightEngineImage.tag }} +{{- else }} + {{- printf "%s:%s" .Values.searchServicesImage.repository .Values.searchServicesImage.tag }} +{{- end }} +{{- end -}} diff --git a/charts/alfresco-search-service/templates/_helpers-name.tpl b/charts/alfresco-search-service/templates/_helpers-name.tpl new file mode 100644 index 00000000..d7de1a29 --- /dev/null +++ b/charts/alfresco-search-service/templates/_helpers-name.tpl @@ -0,0 +1,19 @@ +{{- define "alfresco-search-service.deployment.name" -}} +{{- $scope := (dict "Values" (dict "nameOverride" "solr" ) "Chart" .Chart "Release" .Release) }} +{{- include "alfresco-search-service.fullname" $scope }} +{{- end }} + +{{- define "alfresco-search-service.pvc.name" -}} +{{- $scope := (dict "Values" (dict "nameOverride" "solr-claim" ) "Chart" .Chart "Release" .Release) }} +{{- include "alfresco-search-service.fullname" $scope }} +{{- end }} + +{{- define "alfresco-search-service.repository-config.name" -}} +{{- $scope := (dict "Values" (dict "nameOverride" "solr-repository-config" ) "Chart" .Chart "Release" .Release) }} +{{- include "alfresco-search-service.fullname" $scope }} +{{- end }} + +{{- define "alfresco-search-service.ingress-secret.name" -}} +{{- $scope := (dict "Values" (dict "nameOverride" "solr-ingress-credentials" ) "Chart" .Chart "Release" .Release) }} +{{- include "alfresco-search-service.fullname" $scope }} +{{- end }} diff --git a/charts/alfresco-search-service/templates/_helpers.tpl b/charts/alfresco-search-service/templates/_helpers.tpl index 9ef21d5d..84c73d08 100644 --- a/charts/alfresco-search-service/templates/_helpers.tpl +++ b/charts/alfresco-search-service/templates/_helpers.tpl @@ -23,58 +23,6 @@ If release name contains chart name it will be used as a full name. {{- end }} {{- end }} -{{/* -Alfresco Search Service Host -*/}} -{{- define "alfresco-search.host" -}} - {{ printf "%s-solr" (include "alfresco-search-service.fullname" .) }} -{{- end -}} - -{{/* -Get Alfresco Search container Port ("internal") -*/}} -{{- define "alfresco-search.containerPort" -}} -{{- if and (.Values.type) (eq (.Values.type | toString) "insight-engine") }} -{{- .Values.insightEngineImage.internalPort | default 8983 | int -}} -{{- else }} -{{- .Values.searchServicesImage.internalPort | default 8983 | int -}} -{{- end }} -{{- end -}} - -{{/* -Get Alfresco Search Service Port -*/}} -{{- define "alfresco-search.svcPort" -}} -{{- $defaultSvcPort := 80 }} -{{- if hasKey .Values "service" }} - {{- coalesce .Values.service.externalPort $defaultSvcPort | int }} -{{- else }} - {{- $defaultSvcPort | int }} -{{- end }} -{{- end -}} - -{{/* -Get Alfresco Search Pull Policy -*/}} -{{- define "alfresco-search.pullPolicy" -}} -{{- if and (.Values.type) (eq (.Values.type | toString) "insight-engine") }} -{{- print .Values.insightEngineImage.pullPolicy -}} -{{- else }} -{{- print .Values.searchServicesImage.pullPolicy -}} -{{- end }} -{{- end -}} - -{{/* -Get Alfresco Search Docker Image -*/}} -{{- define "alfresco-search.dockerImage" -}} -{{- if and (.Values.type) (eq (.Values.type | toString) "insight-engine") }} - {{- printf "%s:%s" .Values.insightEngineImage.repository .Values.insightEngineImage.tag }} -{{- else }} - {{- printf "%s:%s" .Values.searchServicesImage.repository .Values.searchServicesImage.tag }} -{{- end }} -{{- end -}} - {{/* Create chart name and version as used by the chart label. */}} diff --git a/charts/alfresco-search-service/templates/config.yaml b/charts/alfresco-search-service/templates/config.yaml index b86c95a0..0150dce8 100644 --- a/charts/alfresco-search-service/templates/config.yaml +++ b/charts/alfresco-search-service/templates/config.yaml @@ -2,20 +2,13 @@ apiVersion: v1 kind: ConfigMap metadata: - {{- $ctx := dict "Values" (dict "nameOverride" (printf "%s-repository" $.Chart.Name )) "Chart" $.Chart "Release" $.Release }} - name: {{ template "alfresco-search-service.fullname" $ctx }} + name: {{ template "alfresco-search-service.repository-config.name" . }} labels: - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - component: search + {{- include "alfresco-search-service.labels" . | nindent 4 }} data: {{- with .Values.repository }} - SOLR_ALFRESCO_HOST: >- - {{ template "alfresco-common.url.host" .url }} - SOLR_ALFRESCO_PORT: >- - {{ template "alfresco-common.url.port" .url }} + {{ .existingConfigMap.keys.host }}: {{ .host | quote }} + {{ .existingConfigMap.keys.port }}: {{ .port | quote }} + {{ .existingConfigMap.keys.securecomms }}: {{ .securecomms | quote }} {{- end }} - SOLR_ALFRESCO_SECURE_COMMS: >- - {{ .Values.repository.securecomms }} {{- end }} diff --git a/charts/alfresco-search-service/templates/deployment.yaml b/charts/alfresco-search-service/templates/deployment.yaml index 6db417d6..624a293d 100644 --- a/charts/alfresco-search-service/templates/deployment.yaml +++ b/charts/alfresco-search-service/templates/deployment.yaml @@ -2,80 +2,61 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ template "alfresco-search-service.fullname" . }}-solr + name: {{ template "alfresco-search-service.deployment.name" . }} labels: - app: {{ template "alfresco-search-service.fullname" . }}-solr - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - component: search + {{- include "alfresco-search-service.labels" . | nindent 4 }} spec: replicas: 1 strategy: type: Recreate selector: matchLabels: - app: {{ template "alfresco-search-service.fullname" . }}-solr - release: {{ .Release.Name }} + {{- include "alfresco-search-service.selectorLabels" . | nindent 6 }} template: metadata: annotations: - checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} {{- with .Values.podAnnotations }} - {{- toYaml . | nindent 8 }} + {{- toYaml . | nindent 8 }} {{- end }} labels: - app: {{ template "alfresco-search-service.fullname" . }}-solr - release: {{ .Release.Name }} + {{- include "alfresco-search-service.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} spec: - {{- include "component-pod-security-context" .Values | indent 4 }} - {{- with .Values.affinity }} - affinity: -{{ tpl . $ | indent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: -{{ toYaml . | indent 8 }} - {{- end }} - {{- if .Values.nodeSelector }} - nodeSelector: {{- .Values.nodeSelector | toYaml | nindent 8 }} - {{- end }} {{- include "alfresco-content-services.imagePullSecrets" . | nindent 6 }} + serviceAccountName: {{ include "alfresco-search-service.serviceAccountName" . }} + {{- include "alfresco-common.component-pod-security-context" .Values | indent 4 }} containers: - name: {{ .Chart.Name }} image: {{ template "alfresco-search.dockerImage" . }} imagePullPolicy: {{ template "alfresco-search.pullPolicy" . }} - {{- include "component-security-context" .Values | indent 8 }} - {{- $repoCtx := dict "Values" (dict "nameOverride" (printf "%s-repository" $.Chart.Name )) "Chart" $.Chart "Release" $.Release }} - {{- $cm := coalesce .Values.repository.existingConfigMap.name (include "alfresco-search-service.fullname" $repoCtx) }} - {{- $secret := coalesce .Values.repository.existingSecret.name (include "alfresco-search-service.fullname" $repoCtx) }} + {{- include "alfresco-common.component-security-context" .Values | indent 8 }} env: {{- with .Values.repository }} - {{- if eq .securecomms "secret" }} - name: SOLR_ALFRESCO_SECURECOMMS_SECRET valueFrom: secretKeyRef: - name: {{ $secret }} - key: {{ index .existingSecret.keys "sharedSecret" }} - {{- end }} + name: {{ .existingSecret.name | default (include "alfresco-search-service.repository-config.name" $) }} + key: {{ .existingSecret.keys.sharedSecret }} - name: SOLR_ALFRESCO_HOST valueFrom: configMapKeyRef: - name: {{ $cm }} + name: {{ .existingConfigMap.name | default (include "alfresco-search-service.repository-config.name" $) }} key: {{ .existingConfigMap.keys.host }} - name: SOLR_ALFRESCO_PORT valueFrom: configMapKeyRef: - name: {{ $cm }} + name: {{ .existingConfigMap.name | default (include "alfresco-search-service.repository-config.name" $) }} key: {{ .existingConfigMap.keys.port }} - name: SOLR_ALFRESCO_SECURECOMMS valueFrom: configMapKeyRef: - name: {{ $cm }} + name: {{ .existingConfigMap.name | default (include "alfresco-search-service.repository-config.name" $) }} key: {{ .existingConfigMap.keys.securecomms }} {{- end }} - name: SOLR_SOLR_HOST - value: {{ template "alfresco-search-service.fullname" . }}-solr + value: {{ template "alfresco-search-service.deployment.name" . }} - name: SOLR_SOLR_PORT value: {{ include "alfresco-search.svcPort" . | quote }} - name: SOLR_SOLR_BASEURL @@ -85,9 +66,6 @@ spec: - name: {{ $key }} value: {{ $val | quote }} {{- end }} - envFrom: - - configMapRef: - name: {{ $cm }} ports: - containerPort: {{ template "alfresco-search.containerPort" . }} resources: {{- toYaml .Values.resources | nindent 12 }} @@ -95,6 +73,9 @@ spec: - name: data mountPath: {{ .Values.persistence.search.data.mountPath }} subPath: {{ .Values.persistence.search.data.subPath }} + {{- with .Values.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} readinessProbe: exec: command: @@ -127,7 +108,19 @@ spec: failureThreshold: 1 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} volumes: - - name: data - persistentVolumeClaim: - claimName: |- - {{ .Values.persistence.existingClaim | default (printf "%s-solr-claim" (include "alfresco-search-service.fullname" .)) }} + {{- include "alfresco-common.data_volume" .Values | nindent 8 }} + {{- with .Values.volumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- tpl . $ | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/alfresco-search-service/templates/ingress.yaml b/charts/alfresco-search-service/templates/ingress.yaml index fa08ebeb..ac53929c 100644 --- a/charts/alfresco-search-service/templates/ingress.yaml +++ b/charts/alfresco-search-service/templates/ingress.yaml @@ -1,19 +1,19 @@ {{- if .Values.ingress.enabled }} -{{- $serviceName := printf "%s-%s" (include "alfresco-search-service.fullname" .) "solr" -}} {{- $servicePort := .Values.service.name | default (include "alfresco-search.svcPort" .) -}} -{{- $backendSvc := dict "serviceName" $serviceName "servicePort" $servicePort "context" $ -}} - -apiVersion: {{ template "common.capabilities.ingress.apiVersion" . }} +{{- $backendSvc := dict "serviceName" (include "alfresco-search-service.deployment.name" .) "servicePort" $servicePort "context" $ -}} +apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: {{ template "alfresco-search-service.fullname" . }}-solr + name: {{ template "alfresco-search-service.deployment.name" . }} annotations: - kubernetes.io/ingress.class: "nginx" - nginx.ingress.kubernetes.io/auth-secret: {{ $.Values.ingress.existingSecretName | default (printf "%s-ingress-secret" (include "alfresco-search-service.fullname" $)) }} - {{- if .Values.ingress.annotations -}} - {{ toYaml .Values.ingress.annotations | nindent 4 }} - {{- end }} + nginx.ingress.kubernetes.io/auth-secret: {{ $.Values.ingress.existingSecretName | default (include "alfresco-search-service.ingress-secret.name" .) }} + {{- if .Values.ingress.annotations -}} + {{- toYaml .Values.ingress.annotations | nindent 4 }} + {{- end }} + labels: + {{- include "alfresco-search-service.labels" . | nindent 4 }} spec: + ingressClassName: nginx {{- if .Values.ingress.tls }} tls: {{- range .Values.ingress.tls }} diff --git a/charts/alfresco-search-service/templates/pvc.yaml b/charts/alfresco-search-service/templates/pvc.yaml index dfc1b73e..aae27ffe 100644 --- a/charts/alfresco-search-service/templates/pvc.yaml +++ b/charts/alfresco-search-service/templates/pvc.yaml @@ -1,49 +1,3 @@ -{{- if .Values.persistence.enabled -}} -{{- if .Values.persistence.EbsPvConfiguration.volumeID }} -apiVersion: v1 -kind: PersistentVolume -metadata: - name: {{ template "alfresco-search-service.fullname" . }}-solr-pv - labels: - app: {{ template "alfresco-search-service.fullname" . }}-solr - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - component: search -spec: - capacity: - storage: {{ .Values.persistence.VolumeSizeRequest }} - storageClassName: {{ template "alfresco-search-service.fullname" . }}-solr-sc - accessModes: - - "ReadWriteOnce" - {{- with .Values.PvNodeAffinity }} - nodeAffinity: -{{ toYaml . | indent 4 }} - {{- end }} - {{- with .Values.persistence.EbsPvConfiguration }} - awsElasticBlockStore: -{{ toYaml . | indent 4 }} - {{- end }} ---- +{{- if and (not .Values.persistence.existingClaim) .Values.persistence.enabled }} + {{- include "alfresco-common.component_pvc" .Values }} {{- end }} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ template "alfresco-search-service.fullname" . }}-solr-claim - labels: - app: {{ template "alfresco-search-service.fullname" . }}-solr - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - component: search -spec: - accessModes: - - ReadWriteOnce - volumeMode: Filesystem - resources: - requests: - storage: {{ .Values.persistence.VolumeSizeRequest }} - {{- if .Values.persistence.EbsPvConfiguration.volumeID }} - storageClassName: {{ template "alfresco-search-service.fullname" . }}-solr-sc - {{- end }} -{{- end -}} diff --git a/charts/alfresco-search-service/templates/secret-ingress.yaml b/charts/alfresco-search-service/templates/secret-ingress.yaml index 0149def8..08dd4e36 100644 --- a/charts/alfresco-search-service/templates/secret-ingress.yaml +++ b/charts/alfresco-search-service/templates/secret-ingress.yaml @@ -2,10 +2,9 @@ apiVersion: v1 kind: Secret metadata: - name: {{ template "alfresco-search-service.fullname" . }}-ingress-secret + name: {{ template "alfresco-search-service.ingress-secret.name" . }} labels: - app: {{ template "alfresco-search-service.fullname" . }}-solr - release: {{ .Release.Name }} + {{- include "alfresco-search-service.labels" . | nindent 4 }} type: Opaque data: auth: {{ .Values.ingress.basicAuth | quote }} diff --git a/charts/alfresco-search-service/templates/secret-repository.yaml b/charts/alfresco-search-service/templates/secret-repository.yaml index ccf31a87..cf7131af 100644 --- a/charts/alfresco-search-service/templates/secret-repository.yaml +++ b/charts/alfresco-search-service/templates/secret-repository.yaml @@ -1,15 +1,14 @@ -{{- if (not .Values.repository.existingSecret.name) }} -{{- if and (eq "secret" .Values.repository.securecomms) (not .Values.repository.existingConfigMap.name) }} +{{- $secureCommsSet := and (eq "secret" .Values.repository.securecomms) (not .Values.repository.existingConfigMap.name) }} +{{- if and (not .Values.repository.existingSecret.name) $secureCommsSet }} apiVersion: v1 kind: Secret -metadata: {{- $ctx := dict "Values" (dict "nameOverride" (printf "%s-repository" $.Chart.Name )) "Chart" $.Chart "Release" $.Release }} - name: {{ template "alfresco-search-service.fullname" $ctx }} +metadata: + name: {{ template "alfresco-search-service.repository-config.name" . }} labels: - {{ template "alfresco-search-service.labels" . }} + {{- include "alfresco-search-service.labels" . | nindent 4 }} type: Opaque data: {{- $reqmsg := "Please provide a shared secret for solr and repository in value repository.sharedSecret" }} - {{- $shared_secret := required $reqmsg (index .Values.repository "sharedSecret") }} + {{- $shared_secret := required $reqmsg .Values.repository.sharedSecret }} SOLR_ALFRESCO_SECURECOMMS_SECRET: {{ $shared_secret | b64enc | quote }} {{- end }} -{{- end }} diff --git a/charts/alfresco-search-service/templates/service.yaml b/charts/alfresco-search-service/templates/service.yaml index 51ed6b44..4003e73b 100644 --- a/charts/alfresco-search-service/templates/service.yaml +++ b/charts/alfresco-search-service/templates/service.yaml @@ -1,13 +1,9 @@ -# Defines the service for the Alfresco Search (Solr) App apiVersion: v1 kind: Service metadata: - name: {{ template "alfresco-search-service.fullname" . }}-solr + name: {{ template "alfresco-search-service.deployment.name" . }} labels: - app: {{ template "alfresco-search-service.fullname" . }}-solr - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + {{- include "alfresco-search-service.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: @@ -15,5 +11,4 @@ spec: targetPort: {{ template "alfresco-search.containerPort" . }} name: {{ .Values.service.name }} selector: - app: {{ template "alfresco-search-service.fullname" . }}-solr - release: {{ .Release.Name }} + {{- include "alfresco-search-service.selectorLabels" . | nindent 4 }} diff --git a/charts/alfresco-search-service/templates/serviceAccount.yaml b/charts/alfresco-search-service/templates/serviceAccount.yaml new file mode 100644 index 00000000..cd662b63 --- /dev/null +++ b/charts/alfresco-search-service/templates/serviceAccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "alfresco-search-service.serviceAccountName" . }} + labels: + {{- include "alfresco-search-service.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/alfresco-search-service/tests/config_test.yaml b/charts/alfresco-search-service/tests/config_test.yaml index 11199d8c..792b4899 100644 --- a/charts/alfresco-search-service/tests/config_test.yaml +++ b/charts/alfresco-search-service/tests/config_test.yaml @@ -21,7 +21,8 @@ tests: values: *testvalues set: repository: - url: http://somehost:8888 + host: somehost + port: 8888 asserts: - equal: path: data.SOLR_ALFRESCO_HOST @@ -32,7 +33,8 @@ tests: - equal: path: data.SOLR_ALFRESCO_SECURE_COMMS value: secret - - it: should not render configmap + + - it: should not render when existingConfigMap is set values: *testvalues set: repository: diff --git a/charts/alfresco-search-service/tests/deployment_test.yaml b/charts/alfresco-search-service/tests/deployment_test.yaml index 28ef5acf..f986fd7d 100644 --- a/charts/alfresco-search-service/tests/deployment_test.yaml +++ b/charts/alfresco-search-service/tests/deployment_test.yaml @@ -7,11 +7,11 @@ tests: - it: should have basic metadata in place values: &testvalues - values/test_values.yaml + template: deployment.yaml asserts: - equal: path: metadata.name - value: RELEASE-NAME-alfresco-search-service-solr - template: deployment.yaml + value: RELEASE-NAME-solr - it: should render cpu and memory limits values: *testvalues @@ -31,14 +31,29 @@ tests: limits: cpu: "4" memory: "2000Mi" + + - it: should render annotations and environments + values: *testvalues + set: + podAnnotations: *annotated + podLabels: + a_label: true + environment: + someother: value + template: deployment.yaml + asserts: - isSubset: path: spec.template.metadata.annotations content: *annotated + - isSubset: + path: spec.template.metadata.labels + content: + a_label: true - contains: path: spec.template.spec.containers[0].env content: name: SOLR_SOLR_HOST - value: RELEASE-NAME-alfresco-search-service-solr + value: RELEASE-NAME-solr - contains: path: spec.template.spec.containers[0].env content: @@ -54,3 +69,41 @@ tests: content: name: someother value: value + + - it: should render default pvc volumes + values: *testvalues + template: deployment.yaml + asserts: + - equal: + path: spec.template.spec.containers[0].volumeMounts + value: + - name: data + mountPath: /opt/alfresco-search-services/data + subPath: alfresco-content-services/solr-data + - equal: + path: spec.template.spec.volumes + value: + - name: data + persistentVolumeClaim: + claimName: solr-default-pvc + + - it: should render cpu and memory limits + set: + resources: + requests: + cpu: "1" + memory: "1500Mi" + limits: + cpu: "4" + memory: "3000Mi" + asserts: + - equal: + path: spec.template.spec.containers[0].resources + value: + requests: + cpu: "1" + memory: "1500Mi" + limits: + cpu: "4" + memory: "3000Mi" + template: deployment.yaml diff --git a/charts/alfresco-search-service/tests/ingress_test.yaml b/charts/alfresco-search-service/tests/ingress_test.yaml index c38d31c6..a179afcd 100644 --- a/charts/alfresco-search-service/tests/ingress_test.yaml +++ b/charts/alfresco-search-service/tests/ingress_test.yaml @@ -3,15 +3,27 @@ suite: test ingress templates: - ingress.yaml tests: - - it: should have basic metadata in place - values: &testvalues + - it: should reference the existing secret + values: - values/test_values.yaml - - values/ingress.yaml + set: + ingress: + enabled: true asserts: - equal: path: metadata.name - value: RELEASE-NAME-alfresco-search-service-solr + value: RELEASE-NAME-solr + template: ingress.yaml + - equal: + path: metadata.annotations['nginx.ingress.kubernetes.io/auth-secret'] + value: RELEASE-NAME-solr-ingress-credentials template: ingress.yaml + + - it: should contains values overrides + values: + - values/test_values.yaml + - values/ingress_enabled.yaml + asserts: - equal: path: metadata.annotations['nginx.ingress.kubernetes.io/auth-secret'] value: staging/solradmin @@ -24,14 +36,3 @@ tests: path: metadata.annotations['nginx.ingress.kubernetes.io/auth-type'] value: basic template: ingress.yaml - - - it: should reference the existing secret - set: - ingress: - enabled: true - existingSecretName: my-custom-ingress-secret - asserts: - - equal: - path: metadata.annotations['nginx.ingress.kubernetes.io/auth-secret'] - value: my-custom-ingress-secret - template: ingress.yaml diff --git a/charts/alfresco-search-service/tests/resources_test.yaml b/charts/alfresco-search-service/tests/resources_test.yaml deleted file mode 100644 index 4e530de9..00000000 --- a/charts/alfresco-search-service/tests/resources_test.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -suite: test resource management -templates: - - deployment.yaml - - config.yaml -tests: - - it: should render cpu and memory limits - set: - resources: - requests: - cpu: "1" - memory: "1500Mi" - limits: - cpu: "4" - memory: "3000Mi" - asserts: - - equal: - path: spec.template.spec.containers[0].resources - value: - requests: - cpu: "1" - memory: "1500Mi" - limits: - cpu: "4" - memory: "3000Mi" - template: deployment.yaml diff --git a/charts/alfresco-search-service/tests/secret-ingress_test.yaml b/charts/alfresco-search-service/tests/secret-ingress_test.yaml new file mode 100644 index 00000000..33a45771 --- /dev/null +++ b/charts/alfresco-search-service/tests/secret-ingress_test.yaml @@ -0,0 +1,33 @@ +--- +suite: test ingress secret +templates: + - secret-ingress.yaml +tests: + - it: should have credentials in the default ingress secret + values: &testvalues + - values/test_values.yaml + - values/ingress_enabled.yaml + set: + ingress.existingSecretName: null + asserts: + - equal: + path: data.auth + value: YWRtaW46JGFwcjEkVVJqb29uS00kSEMuS1EwVkRScFpwSHB2a3JwTDd1Lg== + + - it: should not render ingress secret when ingress is disabled + values: *testvalues + set: + ingress: + enabled: false + asserts: + - hasDocuments: + count: 0 + + - it: should not render ingress secret when existing secret is provided + values: *testvalues + set: + ingress: + existingSecretName: my-custom-secret + asserts: + - hasDocuments: + count: 0 diff --git a/charts/alfresco-search-service/tests/secret-repository_test.yaml b/charts/alfresco-search-service/tests/secret-repository_test.yaml new file mode 100644 index 00000000..16a25e0e --- /dev/null +++ b/charts/alfresco-search-service/tests/secret-repository_test.yaml @@ -0,0 +1,32 @@ +--- +suite: test repository secret +templates: + - secret-repository.yaml +tests: + - it: should render the secret from values + values: &testvalues + - values/test_values.yaml + asserts: + - equal: + path: data.SOLR_ALFRESCO_SECURECOMMS_SECRET + decodeBase64: true + value: dummy + + - it: should not render the secret when existing is provided + values: *testvalues + set: + repository: + existingSecret: + name: mysecret + asserts: + - hasDocuments: + count: 0 + + - it: should not render the secret if securecomms is set to none + values: *testvalues + set: + repository: + securecomms: none + asserts: + - hasDocuments: + count: 0 diff --git a/charts/alfresco-search-service/tests/secrets_test.yaml b/charts/alfresco-search-service/tests/secrets_test.yaml deleted file mode 100644 index baf6fa9d..00000000 --- a/charts/alfresco-search-service/tests/secrets_test.yaml +++ /dev/null @@ -1,66 +0,0 @@ ---- -suite: test solr secrets -templates: - - secret-ingress.yaml - - secret-repository.yaml -tests: - - it: should have credentials in the default ingress secret - values: &testvalues - - values/test_values.yaml - - values/ingress.yaml - set: - ingress.existingSecretName: null - template: secret-ingress.yaml - asserts: - - equal: - path: data.auth - value: YWRtaW46JGFwcjEkVVJqb29uS00kSEMuS1EwVkRScFpwSHB2a3JwTDd1Lg== - - - it: should not render ingress secret when ingress is disabled - values: *testvalues - set: - ingress: - enabled: false - template: secret-ingress.yaml - asserts: - - hasDocuments: - count: 0 - - - it: should not render ingress secret when and existing secret name is set - values: *testvalues - set: - ingress: - existingSecretName: my-custom-secret - template: secret-ingress.yaml - asserts: - - hasDocuments: - count: 0 - - - it: should render the shared secret from values - values: *testvalues - template: secret-repository.yaml - asserts: - - equal: - path: data.SOLR_ALFRESCO_SECURECOMMS_SECRET - value: "ZHVtbXk=" - - - it: should not render a shared secret if securecomms is not set to "secret" - values: *testvalues - set: - repository: - securecomms: none - template: secret-repository.yaml - asserts: - - hasDocuments: - count: 0 - - it: should not render a shared secret if securecomms is not set to "secret" - values: *testvalues - set: - repository: - securecomms: secret - existingSecret: - name: mysecret - template: secret-repository.yaml - asserts: - - hasDocuments: - count: 0 diff --git a/charts/alfresco-search-service/tests/values/ingress.yaml b/charts/alfresco-search-service/tests/values/ingress_enabled.yaml similarity index 100% rename from charts/alfresco-search-service/tests/values/ingress.yaml rename to charts/alfresco-search-service/tests/values/ingress_enabled.yaml diff --git a/charts/alfresco-search-service/tests/values/test_values.yaml b/charts/alfresco-search-service/tests/values/test_values.yaml index 0c2fdbd7..d6d06c4e 100644 --- a/charts/alfresco-search-service/tests/values/test_values.yaml +++ b/charts/alfresco-search-service/tests/values/test_values.yaml @@ -1,3 +1,5 @@ --- repository: + host: alfresco-search-service + port: 80 sharedSecret: dummy diff --git a/charts/alfresco-search-service/values.yaml b/charts/alfresco-search-service/values.yaml index 560e001e..1269ff02 100644 --- a/charts/alfresco-search-service/values.yaml +++ b/charts/alfresco-search-service/values.yaml @@ -1,7 +1,4 @@ --- -# -- Define the alfresco-search properties to use in the k8s cluster -# This is the search provider used by alfresco-content-repository -nodeSelector: {} # -- Define the type of Alfresco Search to use. The default is Alfresco Search # Services. # The type can be set to use Insight Engine with @@ -62,22 +59,22 @@ ingress: nginx.ingress.kubernetes.io/whitelist-source-range: 0.0.0.0/0 # Below values must be set by parent chart repository: - # -- Alfresco repository URL - url: http://alfresco-search-service/solr - # -- repository security level to use when tracking the repo ('none' or 'secret') + # -- Alfresco repository hostname + host: null + # -- Alfresco repository port + port: null + # -- Alfresco repository security level to use when tracking the repo ('none' or 'secret') securecomms: secret - # -- Secret shared with the repository when securecomms is set to 'secret' + # -- Shared secret used with repository when `securecomms` is `secret` sharedSecret: null existingSecret: - # -- Name of a pre-existing secret containing message broker credentials + # -- Alternatively, provide a pre-existing secret containing the shared secret used with repository when `securecomms` is `secret` name: null keys: # -- Key within the secret holding the repository shared secret sharedSecret: SOLR_ALFRESCO_SECURECOMMS_SECRET existingConfigMap: # -- Name of a pre-existing configmap containing Alfresco repository URL - # In addition to tjhe keys mentionned bellow the configMap may contain any - # solr property translated as an env variable (e.g SOLR_ALFRESCO_BASEURL). name: null keys: # -- Key within the configmap holding the repository hostname @@ -88,6 +85,7 @@ repository: securecomms: SOLR_ALFRESCO_SECURE_COMMS environment: SOLR_CREATE_ALFRESCO_DEFAULTS: alfresco,archive + resources: requests: cpu: "0.50" @@ -95,21 +93,26 @@ resources: limits: cpu: "4" memory: "2000Mi" -# -- Defines the persistence + persistence: - # -- If set to false data will be lost with pods + # -- When disabled, data is lost when pod is terminated/rescheduled enabled: true - # -- Only define if you have a specific claim already created - # existingClaim: "search-master-claim" - VolumeSizeRequest: 10Gi + # -- Capacity of the PVC for persistency + baseSize: 10Gi + accessModes: + - ReadWriteOnce + # -- Bind PVC based on storageClass (e.g. dynamic provisioning) + storageClass: null + # -- Provide a pre-existing PVC for persistency + existingClaim: null search: data: mountPath: "/opt/alfresco-search-services/data" subPath: "alfresco-content-services/solr-data" - EbsPvConfiguration: - fsType: ext4 + alfresco-insight-zeppelin: enabled: false + readinessProbe: initialDelaySeconds: 60 periodSeconds: 20 @@ -118,6 +121,7 @@ livenessProbe: initialDelaySeconds: 130 periodSeconds: 20 timeoutSeconds: 10 + initContainer: image: repository: busybox @@ -128,5 +132,22 @@ initContainer: memory: "5Mi" limits: memory: "10Mi" + global: alfrescoRegistryPullSecrets: quay-registry-secret + +nodeSelector: {} +tolerations: [] +# -- Pod affinity, passed thru tpl function +affinity: |- + +serviceAccount: + # -- Specifies whether a service account should be created + create: true + # -- Automatically mount a ServiceAccount's API credentials? + automount: true + # -- Annotations to add to the service account + annotations: {} + # -- The name of the service account to use. If not set and create is true, a + # name is generated using the fullname template + name: ""