From d5667cd3482b00fe436b302d689ff14b585f21ab Mon Sep 17 00:00:00 2001 From: George Taylor Date: Thu, 9 May 2024 18:21:38 +0100 Subject: [PATCH] untar chart --- .../charts/alfresco-search-service/Chart.lock | 9 + .../charts/alfresco-search-service/Chart.yaml | 26 ++ .../charts/alfresco-search-service/README.md | 75 ++++ .../alfresco-search-service/README.md.gotmpl | 18 + .../charts/alfresco-common/.helmignore | 25 ++ .../charts/alfresco-common/Chart.lock | 6 + .../charts/alfresco-common/Chart.yaml | 11 + .../charts/alfresco-common/README.md | 15 + .../charts/alfresco-common/README.md.gotmpl | 18 + .../alfresco-common/charts/common/.helmignore | 22 ++ .../alfresco-common/charts/common/Chart.yaml | 23 ++ .../alfresco-common/charts/common/README.md | 350 ++++++++++++++++++ .../charts/common/templates/_affinities.tpl | 102 +++++ .../charts/common/templates/_capabilities.tpl | 154 ++++++++ .../charts/common/templates/_errors.tpl | 23 ++ .../charts/common/templates/_images.tpl | 75 ++++ .../charts/common/templates/_ingress.tpl | 68 ++++ .../charts/common/templates/_labels.tpl | 18 + .../charts/common/templates/_names.tpl | 70 ++++ .../charts/common/templates/_secrets.tpl | 140 +++++++ .../charts/common/templates/_storage.tpl | 23 ++ .../charts/common/templates/_tplvalues.tpl | 13 + .../charts/common/templates/_utils.tpl | 62 ++++ .../charts/common/templates/_warnings.tpl | 14 + .../templates/validations/_cassandra.tpl | 72 ++++ .../common/templates/validations/_mariadb.tpl | 103 ++++++ .../common/templates/validations/_mongodb.tpl | 108 ++++++ .../common/templates/validations/_mysql.tpl | 103 ++++++ .../templates/validations/_postgresql.tpl | 129 +++++++ .../common/templates/validations/_redis.tpl | 76 ++++ .../templates/validations/_validations.tpl | 46 +++ .../alfresco-common/charts/common/values.yaml | 5 + .../templates/_helpers-activemq.tpl | 17 + .../templates/_helpers-image-pull-secrets.tpl | 6 + .../templates/_helpers-persistence.tpl | 41 ++ .../templates/_helpers-search.tpl | 17 + .../templates/_helpers-security.tpl | 32 ++ .../alfresco-common/templates/_helpers.tpl | 9 + .../charts/alfresco-common/values.yaml | 0 .../alfresco-insight-zeppelin/Chart.lock | 6 + .../alfresco-insight-zeppelin/Chart.yaml | 18 + .../alfresco-insight-zeppelin/README.md | 52 +++ .../README.md.gotmpl | 18 + .../templates/_helpers.tpl | 28 ++ .../templates/config.yaml | 17 + .../templates/deployment.yaml | 58 +++ .../templates/ingress.yaml | 17 + .../templates/service.yaml | 20 + .../tests/config_test.yaml | 30 ++ .../tests/deployment_test.yaml | 23 ++ .../alfresco-insight-zeppelin/values.yaml | 52 +++ .../ci/default-values.yaml | 7 + .../templates/NOTES.txt | 30 ++ .../templates/_helpers.tpl | 69 ++++ .../templates/config.yaml | 25 ++ .../templates/deployment.yaml | 94 +++++ .../templates/ingress.yaml | 36 ++ .../templates/pvc.yaml | 49 +++ .../templates/secret-ingress.yaml | 12 + .../templates/secret-solr-jtoolopt.yaml | 12 + .../templates/service.yaml | 19 + .../tests/config_test.yaml | 58 +++ .../tests/deployment_test.yaml | 28 ++ .../tests/ingress_test.yaml | 33 ++ .../tests/resources_test.yaml | 26 ++ .../tests/secret-ingress_test.yaml | 34 ++ .../tests/secret-solr-jtoolopt_test.yaml | 22 ++ .../tests/values/ingress.yaml | 4 + .../tests/values/test_values.yaml | 5 + .../alfresco-search-service/values.yaml | 146 ++++++++ 70 files changed, 3172 insertions(+) create mode 100644 alfresco-content-services/charts/alfresco-search-service/Chart.lock create mode 100644 alfresco-content-services/charts/alfresco-search-service/Chart.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/README.md create mode 100644 alfresco-content-services/charts/alfresco-search-service/README.md.gotmpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/.helmignore create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/Chart.lock create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/Chart.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/README.md create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/README.md.gotmpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/.helmignore create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/Chart.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/README.md create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_affinities.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_capabilities.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_errors.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_images.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_ingress.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_labels.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_names.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_secrets.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_storage.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_tplvalues.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_utils.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_warnings.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_cassandra.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_mariadb.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_mongodb.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_mysql.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_postgresql.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_redis.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_validations.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/values.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-activemq.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-image-pull-secrets.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-persistence.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-search.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-security.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/values.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.lock create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md.gotmpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/_helpers.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/config.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/deployment.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/ingress.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/service.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/config_test.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/deployment_test.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/values.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/ci/default-values.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/templates/NOTES.txt create mode 100644 alfresco-content-services/charts/alfresco-search-service/templates/_helpers.tpl create mode 100644 alfresco-content-services/charts/alfresco-search-service/templates/config.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/templates/deployment.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/templates/ingress.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/templates/pvc.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/templates/secret-ingress.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/templates/secret-solr-jtoolopt.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/templates/service.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/tests/config_test.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/tests/deployment_test.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/tests/ingress_test.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/tests/resources_test.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/tests/secret-ingress_test.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/tests/secret-solr-jtoolopt_test.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/tests/values/ingress.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/tests/values/test_values.yaml create mode 100644 alfresco-content-services/charts/alfresco-search-service/values.yaml diff --git a/alfresco-content-services/charts/alfresco-search-service/Chart.lock b/alfresco-content-services/charts/alfresco-search-service/Chart.lock new file mode 100644 index 0000000..7e53e26 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: alfresco-insight-zeppelin + repository: "" + version: 2.0.0 +- name: alfresco-common + repository: https://alfresco.github.io/alfresco-helm-charts/ + version: 2.0.0 +digest: sha256:73ceeccdb51e1b757c9e7067759f748f716667efb9084b456fad43c3367a8cec +generated: "2023-03-09T11:30:13.663069+01:00" diff --git a/alfresco-content-services/charts/alfresco-search-service/Chart.yaml b/alfresco-content-services/charts/alfresco-search-service/Chart.yaml new file mode 100644 index 0000000..fbd87bd --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/Chart.yaml @@ -0,0 +1,26 @@ +apiVersion: v2 +appVersion: 2.0.7 +dependencies: +- condition: alfresco-insight-zeppelin.enabled + name: alfresco-insight-zeppelin + repository: "" + version: 2.0.0 +- name: alfresco-common + repository: https://alfresco.github.io/alfresco-helm-charts/ + version: 2.0.0 +description: A Helm chart for deploying Alfresco Search Service +home: https://www.alfresco.com +icon: https://avatars0.githubusercontent.com/u/391127?s=200&v=4 +keywords: +- search +- search services +- alfresco search services +- insight +- insight engine +- alfresco insight engine +- solr +- alfresco solr +name: alfresco-search-service +sources: +- https://github.com/Alfresco/alfresco-helm-charts +version: 1.1.0 diff --git a/alfresco-content-services/charts/alfresco-search-service/README.md b/alfresco-content-services/charts/alfresco-search-service/README.md new file mode 100644 index 0000000..ad15498 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/README.md @@ -0,0 +1,75 @@ +# alfresco-search-service + +![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![AppVersion: 2.0.7](https://img.shields.io/badge/AppVersion-2.0.7-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. + +**Homepage:** + +## Source Code + +* + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| | alfresco-insight-zeppelin | 2.0.0 | +| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 2.0.0 | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| PvNodeAffinity | string | `nil` | Define PVNodeAffinity for scheduling SOLR | +| affinity | string | `nil` | Define Affinity for scheduling SOLR | +| alfresco-insight-zeppelin.enabled | bool | `false` | | +| environment.SOLR_CREATE_ALFRESCO_DEFAULTS | string | `"alfresco,archive"` | | +| global.alfrescoRegistryPullSecrets | string | `"quay-registry-secret"` | | +| global.tracking.auth | string | `"secret"` | Select how solr and repo authenticate to each other none: work only prior to acs 7.2 (and was the default) secret: use a shared secret (to specify using `tracking.sharedsecret`) https: to use mTLS auth (require appropriate certificate configuration) | +| global.tracking.sharedsecret | string | `nil` | Shared secret to authenticate repo/solr traffic | +| ingress.basicAuth | string | `nil` | Default solr basic auth user/password: admin / admin You can create your own with htpasswd utilility & encode it with base640. Example: `echo -n "$(htpasswd -nbm admin admin)" | base64 | tr -d '\n'` basicAuth: YWRtaW46JGFwcjEkVVJqb29uS00kSEMuS1EwVkRScFpwSHB2a3JwTDd1Lg== | +| ingress.enabled | bool | `false` | Expose the solr admin console behind basic auth | +| ingress.existingSecretName | string | `nil` | An existing secret that contains an `auth` key with a value in the same format of `ingress.basicAuth` | +| ingress.path | string | `"/solr"` | | +| ingress.tls | list | `[]` | | +| ingress.whitelist_ips | string | `"0.0.0.0/0"` | Comma separated list of CIDR to restrict search endpoint access. | +| initContainer.image.pullPolicy | string | `"IfNotPresent"` | | +| initContainer.image.repository | string | `"busybox"` | | +| initContainer.image.tag | string | `"1.35.0"` | | +| initContainer.resources.limits.memory | string | `"10Mi"` | | +| initContainer.resources.requests.memory | string | `"5Mi"` | | +| insightEngineImage.internalPort | string | `nil` | container's port search service is listening on change if your custom image use a different port. | +| insightEngineImage.pullPolicy | string | `"IfNotPresent"` | | +| insightEngineImage.repository | string | `"quay.io/alfresco/insight-engine"` | | +| insightEngineImage.tag | string | `"2.0.7"` | | +| 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 | +| podSecurityContext.fsGroup | int | `33007` | | +| podSecurityContext.runAsGroup | int | `33007` | | +| podSecurityContext.runAsNonRoot | bool | `true` | | +| podSecurityContext.runAsUser | int | `33007` | | +| readinessProbe.initialDelaySeconds | int | `60` | | +| readinessProbe.periodSeconds | int | `20` | | +| readinessProbe.timeoutSeconds | int | `10` | | +| repository.host | string | `nil` | ACS repository hostname | +| repository.port | string | `nil` | ACS repository port | +| resources.limits.cpu | string | `"4"` | | +| resources.limits.memory | string | `"2000Mi"` | | +| resources.requests.cpu | string | `"0.50"` | | +| resources.requests.memory | string | `"1200Mi"` | | +| searchServicesImage.internalPort | string | `nil` | container's port search service is listening on change if your custom image use a different port. | +| searchServicesImage.pullPolicy | string | `"IfNotPresent"` | | +| searchServicesImage.repository | string | `"quay.io/alfresco/search-services"` | | +| searchServicesImage.tag | string | `"2.0.7"` | | +| service.name | string | `"solr"` | | +| service.type | string | `"ClusterIP"` | | +| tolerations | string | `nil` | Define Tolerations for scheduling SOLR | +| 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/alfresco-content-services/charts/alfresco-search-service/README.md.gotmpl b/alfresco-content-services/charts/alfresco-search-service/README.md.gotmpl new file mode 100644 index 0000000..b301f39 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/README.md.gotmpl @@ -0,0 +1,18 @@ +{{ template "chart.header" . }} +{{ template "chart.deprecationWarning" . }} + +{{ template "chart.badgesSection" . }} + +{{ 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. + +{{ template "chart.homepageLine" . }} + +{{ template "chart.maintainersSection" . }} + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.valuesSection" . }} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/.helmignore b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/.helmignore new file mode 100644 index 0000000..721fe6a --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/.helmignore @@ -0,0 +1,25 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Helm unit tests +tests +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/Chart.lock b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/Chart.lock new file mode 100644 index 0000000..cb293e5 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami/ + version: 1.17.1 +digest: sha256:f5dd11ccf8726befd217545b84a48b02c49d68f03a75e4e102b971ad2e4f0fec +generated: "2022-10-05T16:55:42.662007+02:00" diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/Chart.yaml b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/Chart.yaml new file mode 100644 index 0000000..5662b18 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v2 +dependencies: +- name: common + repository: https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami/ + version: 1.x.x +description: 'A helper subchart to avoid duplication in alfresco charts and set common + external dependencies ' +icon: https://avatars0.githubusercontent.com/u/391127?s=200&v=4 +name: alfresco-common +type: library +version: 2.0.0 diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/README.md b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/README.md new file mode 100644 index 0000000..1df5281 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/README.md @@ -0,0 +1,15 @@ +# alfresco-common + +![Version: 2.0.0](https://img.shields.io/badge/Version-2.0.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) + +A helper subchart to avoid duplication in alfresco charts and set common +external dependencies + +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. + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami/ | common | 1.x.x | + diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/README.md.gotmpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/README.md.gotmpl new file mode 100644 index 0000000..b301f39 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/README.md.gotmpl @@ -0,0 +1,18 @@ +{{ template "chart.header" . }} +{{ template "chart.deprecationWarning" . }} + +{{ template "chart.badgesSection" . }} + +{{ 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. + +{{ template "chart.homepageLine" . }} + +{{ template "chart.maintainersSection" . }} + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.valuesSection" . }} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/.helmignore b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/.helmignore new file mode 100644 index 0000000..50af031 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/Chart.yaml b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/Chart.yaml new file mode 100644 index 0000000..39edbb3 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/Chart.yaml @@ -0,0 +1,23 @@ +annotations: + category: Infrastructure +apiVersion: v2 +appVersion: 1.17.1 +description: A Library Helm Chart for grouping common logic between bitnami charts. + This chart is not deployable by itself. +home: https://github.com/bitnami/charts/tree/master/bitnami/common +icon: https://bitnami.com/downloads/logos/bitnami-mark.png +keywords: +- common +- helper +- template +- function +- bitnami +maintainers: +- name: Bitnami + url: https://github.com/bitnami/charts +name: common +sources: +- https://github.com/bitnami/charts +- https://www.bitnami.com/ +type: library +version: 1.17.1 diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/README.md b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/README.md new file mode 100644 index 0000000..a2ecd60 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/README.md @@ -0,0 +1,350 @@ +# Bitnami Common Library Chart + +A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between bitnami charts. + +## TL;DR + +```yaml +dependencies: + - name: common + version: 1.x.x + repository: https://charts.bitnami.com/bitnami +``` + +```bash +$ helm dependency update +``` + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }} +data: + myvalue: "Hello World" +``` + +## Introduction + +This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager. + +Bitnami charts can be used with [Kubeapps](https://kubeapps.dev/) for deployment and management of Helm Charts in clusters. + +## Prerequisites + +- Kubernetes 1.19+ +- Helm 3.2.0+ + +## Parameters + +The following table lists the helpers available in the library which are scoped in different sections. + +### Affinities + +| Helper identifier | Description | Expected Input | +|-------------------------------|------------------------------------------------------|------------------------------------------------| +| `common.affinities.nodes.soft` | Return a soft nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.nodes.hard` | Return a hard nodeAffinity definition | `dict "key" "FOO" "values" (list "BAR" "BAZ")` | +| `common.affinities.pods.soft` | Return a soft podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | +| `common.affinities.pods.hard` | Return a hard podAffinity/podAntiAffinity definition | `dict "component" "FOO" "context" $` | + +### Capabilities + +| Helper identifier | Description | Expected Input | +|------------------------------------------------|------------------------------------------------------------------------------------------------|-------------------| +| `common.capabilities.kubeVersion` | Return the target Kubernetes version (using client default if .Values.kubeVersion is not set). | `.` Chart context | +| `common.capabilities.cronjob.apiVersion` | Return the appropriate apiVersion for cronjob. | `.` Chart context | +| `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context | +| `common.capabilities.statefulset.apiVersion` | Return the appropriate apiVersion for statefulset. | `.` Chart context | +| `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart context | +| `common.capabilities.rbac.apiVersion` | Return the appropriate apiVersion for RBAC resources. | `.` Chart context | +| `common.capabilities.crd.apiVersion` | Return the appropriate apiVersion for CRDs. | `.` Chart context | +| `common.capabilities.policy.apiVersion` | Return the appropriate apiVersion for podsecuritypolicy. | `.` Chart context | +| `common.capabilities.networkPolicy.apiVersion` | Return the appropriate apiVersion for networkpolicy. | `.` Chart context | +| `common.capabilities.apiService.apiVersion` | Return the appropriate apiVersion for APIService. | `.` Chart context | +| `common.capabilities.hpa.apiVersion` | Return the appropriate apiVersion for Horizontal Pod Autoscaler | `.` Chart context | +| `common.capabilities.supportsHelmVersion` | Returns true if the used Helm version is 3.3+ | `.` Chart context | + +### Errors + +| Helper identifier | Description | Expected Input | +|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| +| `common.errors.upgrade.passwords.empty` | It will ensure required passwords are given when we are upgrading a chart. If `validationErrors` is not empty it will throw an error and will stop the upgrade action. | `dict "validationErrors" (list $validationError00 $validationError01) "context" $` | + +### Images + +| Helper identifier | Description | Expected Input | +|-----------------------------|------------------------------------------------------|---------------------------------------------------------------------------------------------------------| +| `common.images.image` | Return the proper and full image name | `dict "imageRoot" .Values.path.to.the.image "global" $`, see [ImageRoot](#imageroot) for the structure. | +| `common.images.pullSecrets` | Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global` | +| `common.images.renderPullSecrets` | Return the proper Docker Image Registry Secret Names (evaluates values as templates) | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $` | + +### Ingress + +| Helper identifier | Description | Expected Input | +|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.ingress.backend` | Generate a proper Ingress backend entry depending on the API version | `dict "serviceName" "foo" "servicePort" "bar"`, see the [Ingress deprecation notice](https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/) for the syntax differences | +| `common.ingress.supportsPathType` | Prints "true" if the pathType field is supported | `.` Chart context | +| `common.ingress.supportsIngressClassname` | Prints "true" if the ingressClassname field is supported | `.` Chart context | +| `common.ingress.certManagerRequest` | Prints "true" if required cert-manager annotations for TLS signed certificates are set in the Ingress annotations | `dict "annotations" .Values.path.to.the.ingress.annotations` | + +### Labels + +| Helper identifier | Description | Expected Input | +|-----------------------------|-----------------------------------------------------------------------------|-------------------| +| `common.labels.standard` | Return Kubernetes standard labels | `.` Chart context | +| `common.labels.matchLabels` | Labels to use on `deploy.spec.selector.matchLabels` and `svc.spec.selector` | `.` Chart context | + +### Names + +| Helper identifier | Description | Expected Input | +|-----------------------------------|-----------------------------------------------------------------------|-------------------| +| `common.names.name` | Expand the name of the chart or use `.Values.nameOverride` | `.` Chart context | +| `common.names.fullname` | Create a default fully qualified app name. | `.` Chart context | +| `common.names.namespace` | Allow the release namespace to be overridden | `.` Chart context | +| `common.names.fullname.namespace` | Create a fully qualified app name adding the installation's namespace | `.` Chart context | +| `common.names.chart` | Chart name plus version | `.` Chart context | + +### Secrets + +| Helper identifier | Description | Expected Input | +|---------------------------|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.secrets.name` | Generate the name of the secret. | `dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $` see [ExistingSecret](#existingsecret) for the structure. | +| `common.secrets.key` | Generate secret key. | `dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName"` see [ExistingSecret](#existingsecret) for the structure. | +| `common.passwords.manage` | Generate secret password or retrieve one if already created. | `dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $`, length, strong and chartNAme fields are optional. | +| `common.secrets.exists` | Returns whether a previous generated secret already exists. | `dict "secret" "secret-name" "context" $` | + +### Storage + +| Helper identifier | Description | Expected Input | +|-------------------------------|---------------------------------------|---------------------------------------------------------------------------------------------------------------------| +| `common.storage.class` | Return the proper Storage Class | `dict "persistence" .Values.path.to.the.persistence "global" $`, see [Persistence](#persistence) for the structure. | + +### TplValues + +| Helper identifier | Description | Expected Input | +|---------------------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.tplvalues.render` | Renders a value that contains template | `dict "value" .Values.path.to.the.Value "context" $`, value is the value should rendered as template, context frequently is the chart context `$` or `.` | + +### Utils + +| Helper identifier | Description | Expected Input | +|--------------------------------|------------------------------------------------------------------------------------------|------------------------------------------------------------------------| +| `common.utils.fieldToEnvVar` | Build environment variable name given a field. | `dict "field" "my-password"` | +| `common.utils.secret.getvalue` | Print instructions to get a secret value. | `dict "secret" "secret-name" "field" "secret-value-field" "context" $` | +| `common.utils.getValueFromKey` | Gets a value from `.Values` object given its key path | `dict "key" "path.to.key" "context" $` | +| `common.utils.getKeyFromList` | Returns first `.Values` key with a defined value or first of the list if all non-defined | `dict "keys" (list "path.to.key1" "path.to.key2") "context" $` | + +### Validations + +| Helper identifier | Description | Expected Input | +|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `common.validations.values.single.empty` | Validate a value must not be empty. | `dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "subchart" "subchart" "context" $` secret, field and subchart are optional. In case they are given, the helper will generate a how to get instruction. See [ValidateValue](#validatevalue) | +| `common.validations.values.multiple.empty` | Validate a multiple values must not be empty. It returns a shared error for all the values. | `dict "required" (list $validateValueConf00 $validateValueConf01) "context" $`. See [ValidateValue](#validatevalue) | +| `common.validations.values.mariadb.passwords` | This helper will ensure required password for MariaDB are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mariadb chart and the helper. | +| `common.validations.values.mysql.passwords` | This helper will ensure required password for MySQL are not empty. It returns a shared error for all the values. | `dict "secret" "mysql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mysql chart and the helper. | +| `common.validations.values.postgresql.passwords` | This helper will ensure required password for PostgreSQL are not empty. It returns a shared error for all the values. | `dict "secret" "postgresql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. | +| `common.validations.values.redis.passwords` | This helper will ensure required password for Redis® are not empty. It returns a shared error for all the values. | `dict "secret" "redis-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use redis chart and the helper. | +| `common.validations.values.cassandra.passwords` | This helper will ensure required password for Cassandra are not empty. It returns a shared error for all the values. | `dict "secret" "cassandra-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use cassandra chart and the helper. | +| `common.validations.values.mongodb.passwords` | This helper will ensure required password for MongoDB® are not empty. It returns a shared error for all the values. | `dict "secret" "mongodb-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use mongodb chart and the helper. | + +### Warnings + +| Helper identifier | Description | Expected Input | +|------------------------------|----------------------------------|------------------------------------------------------------| +| `common.warnings.rollingTag` | Warning about using rolling tag. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. | + +## Special input schemas + +### ImageRoot + +```yaml +registry: + type: string + description: Docker registry where the image is located + example: docker.io + +repository: + type: string + description: Repository and image name + example: bitnami/nginx + +tag: + type: string + description: image tag + example: 1.16.1-debian-10-r63 + +pullPolicy: + type: string + description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + +pullSecrets: + type: array + items: + type: string + description: Optionally specify an array of imagePullSecrets (evaluated as templates). + +debug: + type: boolean + description: Set to true if you would like to see extra information on logs + example: false + +## An instance would be: +# registry: docker.io +# repository: bitnami/nginx +# tag: 1.16.1-debian-10-r63 +# pullPolicy: IfNotPresent +# debug: false +``` + +### Persistence + +```yaml +enabled: + type: boolean + description: Whether enable persistence. + example: true + +storageClass: + type: string + description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning. + example: "-" + +accessMode: + type: string + description: Access mode for the Persistent Volume Storage. + example: ReadWriteOnce + +size: + type: string + description: Size the Persistent Volume Storage. + example: 8Gi + +path: + type: string + description: Path to be persisted. + example: /bitnami + +## An instance would be: +# enabled: true +# storageClass: "-" +# accessMode: ReadWriteOnce +# size: 8Gi +# path: /bitnami +``` + +### ExistingSecret + +```yaml +name: + type: string + description: Name of the existing secret. + example: mySecret +keyMapping: + description: Mapping between the expected key name and the name of the key in the existing secret. + type: object + +## An instance would be: +# name: mySecret +# keyMapping: +# password: myPasswordKey +``` + +#### Example of use + +When we store sensitive data for a deployment in a secret, some times we want to give to users the possibility of using theirs existing secrets. + +```yaml +# templates/secret.yaml +--- +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.names.fullname" . }} + labels: + app: {{ include "common.names.fullname" . }} +type: Opaque +data: + password: {{ .Values.password | b64enc | quote }} + +# templates/dpl.yaml +--- +... + env: + - name: PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }} + key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }} +... + +# values.yaml +--- +name: mySecret +keyMapping: + password: myPasswordKey +``` + +### ValidateValue + +#### NOTES.txt + +```console +{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}} + +{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} +``` + +If we force those values to be empty we will see some alerts + +```console +$ helm install test mychart --set path.to.value00="",path.to.value01="" + 'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value: + + export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 -d) + + 'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value: + + export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 -d) +``` + +## Upgrading + +### To 1.0.0 + +[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL. + +**What changes were introduced in this major version?** + +- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field. +- Use `type: library`. [Here](https://v3.helm.sh/docs/faq/#library-chart-support) you can find more information. +- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts + +**Considerations when upgrading to this version** + +- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues +- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore +- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3 + +**Useful links** + +- https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/ +- https://helm.sh/docs/topics/v2_v3_migration/ +- https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/ + +## License + +Copyright © 2022 Bitnami + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_affinities.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_affinities.tpl new file mode 100644 index 0000000..2387be2 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_affinities.tpl @@ -0,0 +1,102 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return a soft nodeAffinity definition +{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.soft" -}} +preferredDuringSchedulingIgnoredDuringExecution: + - preference: + matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} + weight: 1 +{{- end -}} + +{{/* +Return a hard nodeAffinity definition +{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes.hard" -}} +requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: {{ .key }} + operator: In + values: + {{- range .values }} + - {{ . | quote }} + {{- end }} +{{- end -}} + +{{/* +Return a nodeAffinity definition +{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.nodes" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.nodes.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.nodes.hard" . -}} + {{- end -}} +{{- end -}} + +{{/* +Return a soft podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.soft" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.soft" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 10 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname + weight: 1 +{{- end -}} + +{{/* +Return a hard podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods.hard" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}} +*/}} +{{- define "common.affinities.pods.hard" -}} +{{- $component := default "" .component -}} +{{- $extraMatchLabels := default (dict) .extraMatchLabels -}} +requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 8 }} + {{- if not (empty $component) }} + {{ printf "app.kubernetes.io/component: %s" $component }} + {{- end }} + {{- range $key, $value := $extraMatchLabels }} + {{ $key }}: {{ $value | quote }} + {{- end }} + namespaces: + - {{ include "common.names.namespace" .context | quote }} + topologyKey: kubernetes.io/hostname +{{- end -}} + +{{/* +Return a podAffinity/podAntiAffinity definition +{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}} +*/}} +{{- define "common.affinities.pods" -}} + {{- if eq .type "soft" }} + {{- include "common.affinities.pods.soft" . -}} + {{- else if eq .type "hard" }} + {{- include "common.affinities.pods.hard" . -}} + {{- end -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_capabilities.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_capabilities.tpl new file mode 100644 index 0000000..9d9b760 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_capabilities.tpl @@ -0,0 +1,154 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Return the target Kubernetes version +*/}} +{{- define "common.capabilities.kubeVersion" -}} +{{- if .Values.global }} + {{- if .Values.global.kubeVersion }} + {{- .Values.global.kubeVersion -}} + {{- else }} + {{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} + {{- end -}} +{{- else }} +{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for poddisruptionbudget. +*/}} +{{- define "common.capabilities.policy.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "policy/v1beta1" -}} +{{- else -}} +{{- print "policy/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for networkpolicy. +*/}} +{{- define "common.capabilities.networkPolicy.apiVersion" -}} +{{- if semverCompare "<1.7-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for cronjob. +*/}} +{{- define "common.capabilities.cronjob.apiVersion" -}} +{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "batch/v1beta1" -}} +{{- else -}} +{{- print "batch/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for deployment. +*/}} +{{- define "common.capabilities.deployment.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for statefulset. +*/}} +{{- define "common.capabilities.statefulset.apiVersion" -}} +{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apps/v1beta1" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for ingress. +*/}} +{{- define "common.capabilities.ingress.apiVersion" -}} +{{- if .Values.ingress -}} +{{- if .Values.ingress.apiVersion -}} +{{- .Values.ingress.apiVersion -}} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end }} +{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "extensions/v1beta1" -}} +{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "networking.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "networking.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for RBAC resources. +*/}} +{{- define "common.capabilities.rbac.apiVersion" -}} +{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "rbac.authorization.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "rbac.authorization.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for CRDs. +*/}} +{{- define "common.capabilities.crd.apiVersion" -}} +{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiextensions.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiextensions.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for APIService. +*/}} +{{- define "common.capabilities.apiService.apiVersion" -}} +{{- if semverCompare "<1.10-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "apiregistration.k8s.io/v1beta1" -}} +{{- else -}} +{{- print "apiregistration.k8s.io/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for Horizontal Pod Autoscaler. +*/}} +{{- define "common.capabilities.hpa.apiVersion" -}} +{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .context) -}} +{{- if .beta2 -}} +{{- print "autoscaling/v2beta2" -}} +{{- else -}} +{{- print "autoscaling/v2beta1" -}} +{{- end -}} +{{- else -}} +{{- print "autoscaling/v2" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the used Helm version is 3.3+. +A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure. +This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error. +**To be removed when the catalog's minimun Helm version is 3.3** +*/}} +{{- define "common.capabilities.supportsHelmVersion" -}} +{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_errors.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_errors.tpl new file mode 100644 index 0000000..a79cc2e --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_errors.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Through error when upgrading using empty passwords values that must not be empty. + +Usage: +{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}} +{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}} +{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }} + +Required password params: + - validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error. + - context - Context - Required. Parent context. +*/}} +{{- define "common.errors.upgrade.passwords.empty" -}} + {{- $validationErrors := join "" .validationErrors -}} + {{- if and $validationErrors .context.Release.IsUpgrade -}} + {{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}} + {{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}} + {{- $errorString = print $errorString "\n Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}} + {{- $errorString = print $errorString "\n%s" -}} + {{- printf $errorString $validationErrors | fail -}} + {{- end -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_images.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_images.tpl new file mode 100644 index 0000000..42ffbc7 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_images.tpl @@ -0,0 +1,75 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper image name +{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }} +*/}} +{{- define "common.images.image" -}} +{{- $registryName := .imageRoot.registry -}} +{{- $repositoryName := .imageRoot.repository -}} +{{- $tag := .imageRoot.tag | toString -}} +{{- if .global }} + {{- if .global.imageRegistry }} + {{- $registryName = .global.imageRegistry -}} + {{- end -}} +{{- end -}} +{{- if $registryName }} +{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- else -}} +{{- printf "%s:%s" $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) +{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }} +*/}} +{{- define "common.images.pullSecrets" -}} + {{- $pullSecrets := list }} + + {{- if .global }} + {{- range .global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets . -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names evaluating values as templates +{{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }} +*/}} +{{- define "common.images.renderPullSecrets" -}} + {{- $pullSecrets := list }} + {{- $context := .context }} + + {{- if $context.Values.global }} + {{- range $context.Values.global.imagePullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- range .images -}} + {{- range .pullSecrets -}} + {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} + {{- end -}} + {{- end -}} + + {{- if (not (empty $pullSecrets)) }} +imagePullSecrets: + {{- range $pullSecrets }} + - name: {{ . }} + {{- end }} + {{- end }} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_ingress.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_ingress.tpl new file mode 100644 index 0000000..8caf73a --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_ingress.tpl @@ -0,0 +1,68 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Generate backend entry that is compatible with all Kubernetes API versions. + +Usage: +{{ include "common.ingress.backend" (dict "serviceName" "backendName" "servicePort" "backendPort" "context" $) }} + +Params: + - serviceName - String. Name of an existing service backend + - servicePort - String/Int. Port name (or number) of the service. It will be translated to different yaml depending if it is a string or an integer. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.ingress.backend" -}} +{{- $apiVersion := (include "common.capabilities.ingress.apiVersion" .context) -}} +{{- if or (eq $apiVersion "extensions/v1beta1") (eq $apiVersion "networking.k8s.io/v1beta1") -}} +serviceName: {{ .serviceName }} +servicePort: {{ .servicePort }} +{{- else -}} +service: + name: {{ .serviceName }} + port: + {{- if typeIs "string" .servicePort }} + name: {{ .servicePort }} + {{- else if or (typeIs "int" .servicePort) (typeIs "float64" .servicePort) }} + number: {{ .servicePort | int }} + {{- end }} +{{- end -}} +{{- end -}} + +{{/* +Print "true" if the API pathType field is supported +Usage: +{{ include "common.ingress.supportsPathType" . }} +*/}} +{{- define "common.ingress.supportsPathType" -}} +{{- if (semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .)) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Returns true if the ingressClassname field is supported +Usage: +{{ include "common.ingress.supportsIngressClassname" . }} +*/}} +{{- define "common.ingress.supportsIngressClassname" -}} +{{- if semverCompare "<1.18-0" (include "common.capabilities.kubeVersion" .) -}} +{{- print "false" -}} +{{- else -}} +{{- print "true" -}} +{{- end -}} +{{- end -}} + +{{/* +Return true if cert-manager required annotations for TLS signed +certificates are set in the Ingress annotations +Ref: https://cert-manager.io/docs/usage/ingress/#supported-annotations +Usage: +{{ include "common.ingress.certManagerRequest" ( dict "annotations" .Values.path.to.the.ingress.annotations ) }} +*/}} +{{- define "common.ingress.certManagerRequest" -}} +{{ if or (hasKey .annotations "cert-manager.io/cluster-issuer") (hasKey .annotations "cert-manager.io/issuer") }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_labels.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_labels.tpl new file mode 100644 index 0000000..252066c --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_labels.tpl @@ -0,0 +1,18 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Kubernetes standard labels +*/}} +{{- define "common.labels.standard" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +helm.sh/chart: {{ include "common.names.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector +*/}} +{{- define "common.labels.matchLabels" -}} +app.kubernetes.io/name: {{ include "common.names.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_names.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_names.tpl new file mode 100644 index 0000000..1bdac8b --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_names.tpl @@ -0,0 +1,70 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "common.names.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "common.names.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +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 "common.names.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 -}} + +{{/* +Create a default fully qualified dependency 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. +Usage: +{{ include "common.names.dependency.fullname" (dict "chartName" "dependency-chart-name" "chartValues" .Values.dependency-chart "context" $) }} +*/}} +{{- define "common.names.dependency.fullname" -}} +{{- if .chartValues.fullnameOverride -}} +{{- .chartValues.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .chartName .chartValues.nameOverride -}} +{{- if contains $name .context.Release.Name -}} +{{- .context.Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .context.Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Allow the release namespace to be overridden for multi-namespace deployments in combined charts. +*/}} +{{- define "common.names.namespace" -}} +{{- if .Values.namespaceOverride -}} +{{- .Values.namespaceOverride -}} +{{- else -}} +{{- .Release.Namespace -}} +{{- end -}} +{{- end -}} + +{{/* +Create a fully qualified app name adding the installation's namespace. +*/}} +{{- define "common.names.fullname.namespace" -}} +{{- printf "%s-%s" (include "common.names.fullname" .) (include "common.names.namespace" .) | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_secrets.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_secrets.tpl new file mode 100644 index 0000000..a53fb44 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_secrets.tpl @@ -0,0 +1,140 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Generate secret name. + +Usage: +{{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "common.secrets.name" -}} +{{- $name := (include "common.names.fullname" .context) -}} + +{{- if .defaultNameSuffix -}} +{{- $name = printf "%s-%s" $name .defaultNameSuffix | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- with .existingSecret -}} +{{- if not (typeIs "string" .) -}} +{{- with .name -}} +{{- $name = . -}} +{{- end -}} +{{- else -}} +{{- $name = . -}} +{{- end -}} +{{- end -}} + +{{- printf "%s" $name -}} +{{- end -}} + +{{/* +Generate secret key. + +Usage: +{{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }} + +Params: + - existingSecret - ExistingSecret/String - Optional. The path to the existing secrets in the values.yaml given by the user + to be used instead of the default one. Allows for it to be of type String (just the secret name) for backwards compatibility. + +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret + - key - String - Required. Name of the key in the secret. +*/}} +{{- define "common.secrets.key" -}} +{{- $key := .key -}} + +{{- if .existingSecret -}} + {{- if not (typeIs "string" .existingSecret) -}} + {{- if .existingSecret.keyMapping -}} + {{- $key = index .existingSecret.keyMapping $.key -}} + {{- end -}} + {{- end }} +{{- end -}} + +{{- printf "%s" $key -}} +{{- end -}} + +{{/* +Generate secret password or retrieve one if already created. + +Usage: +{{ include "common.secrets.passwords.manage" (dict "secret" "secret-name" "key" "keyName" "providedValues" (list "path.to.password1" "path.to.password2") "length" 10 "strong" false "chartName" "chartName" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - key - String - Required - Name of the key in the secret. + - providedValues - List - Required - The path to the validating value in the values.yaml, e.g: "mysql.password". Will pick first parameter with a defined value. + - length - int - Optional - Length of the generated random password. + - strong - Boolean - Optional - Whether to add symbols to the generated random password. + - chartName - String - Optional - Name of the chart used when said chart is deployed as a subchart. + - context - Context - Required - Parent context. + +The order in which this function returns a secret password: + 1. Already existing 'Secret' resource + (If a 'Secret' resource is found under the name provided to the 'secret' parameter to this function and that 'Secret' resource contains a key with the name passed as the 'key' parameter to this function then the value of this existing secret password will be returned) + 2. Password provided via the values.yaml + (If one of the keys passed to the 'providedValues' parameter to this function is a valid path to a key in the values.yaml and has a value, the value of the first key with a value will be returned) + 3. Randomly generated secret password + (A new random secret password with the length specified in the 'length' parameter will be generated and returned) + +*/}} +{{- define "common.secrets.passwords.manage" -}} + +{{- $password := "" }} +{{- $subchart := "" }} +{{- $chartName := default "" .chartName }} +{{- $passwordLength := default 10 .length }} +{{- $providedPasswordKey := include "common.utils.getKeyFromList" (dict "keys" .providedValues "context" $.context) }} +{{- $providedPasswordValue := include "common.utils.getValueFromKey" (dict "key" $providedPasswordKey "context" $.context) }} +{{- $secretData := (lookup "v1" "Secret" $.context.Release.Namespace .secret).data }} +{{- if $secretData }} + {{- if hasKey $secretData .key }} + {{- $password = index $secretData .key }} + {{- else }} + {{- printf "\nPASSWORDS ERROR: The secret \"%s\" does not contain the key \"%s\"\n" .secret .key | fail -}} + {{- end -}} +{{- else if $providedPasswordValue }} + {{- $password = $providedPasswordValue | toString | b64enc | quote }} +{{- else }} + + {{- if .context.Values.enabled }} + {{- $subchart = $chartName }} + {{- end -}} + + {{- $requiredPassword := dict "valueKey" $providedPasswordKey "secret" .secret "field" .key "subchart" $subchart "context" $.context -}} + {{- $requiredPasswordError := include "common.validations.values.single.empty" $requiredPassword -}} + {{- $passwordValidationErrors := list $requiredPasswordError -}} + {{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $.context) -}} + + {{- if .strong }} + {{- $subStr := list (lower (randAlpha 1)) (randNumeric 1) (upper (randAlpha 1)) | join "_" }} + {{- $password = randAscii $passwordLength }} + {{- $password = regexReplaceAllLiteral "\\W" $password "@" | substr 5 $passwordLength }} + {{- $password = printf "%s%s" $subStr $password | toString | shuffle | b64enc | quote }} + {{- else }} + {{- $password = randAlphaNum $passwordLength | b64enc | quote }} + {{- end }} +{{- end -}} +{{- printf "%s" $password -}} +{{- end -}} + +{{/* +Returns whether a previous generated secret already exists + +Usage: +{{ include "common.secrets.exists" (dict "secret" "secret-name" "context" $) }} + +Params: + - secret - String - Required - Name of the 'Secret' resource where the password is stored. + - context - Context - Required - Parent context. +*/}} +{{- define "common.secrets.exists" -}} +{{- $secret := (lookup "v1" "Secret" $.context.Release.Namespace .secret) }} +{{- if $secret }} + {{- true -}} +{{- end -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_storage.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_storage.tpl new file mode 100644 index 0000000..60e2a84 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_storage.tpl @@ -0,0 +1,23 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Return the proper Storage Class +{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }} +*/}} +{{- define "common.storage.class" -}} + +{{- $storageClass := .persistence.storageClass -}} +{{- if .global -}} + {{- if .global.storageClass -}} + {{- $storageClass = .global.storageClass -}} + {{- end -}} +{{- end -}} + +{{- if $storageClass -}} + {{- if (eq "-" $storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" $storageClass -}} + {{- end -}} +{{- end -}} + +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_tplvalues.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_tplvalues.tpl new file mode 100644 index 0000000..2db1668 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_tplvalues.tpl @@ -0,0 +1,13 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Renders a value that contains template. +Usage: +{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "common.tplvalues.render" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_utils.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_utils.tpl new file mode 100644 index 0000000..8c22b2a --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_utils.tpl @@ -0,0 +1,62 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Print instructions to get a secret value. +Usage: +{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }} +*/}} +{{- define "common.utils.secret.getvalue" -}} +{{- $varname := include "common.utils.fieldToEnvVar" . -}} +export {{ $varname }}=$(kubectl get secret --namespace {{ .context.Release.Namespace | quote }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 -d) +{{- end -}} + +{{/* +Build env var name given a field +Usage: +{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }} +*/}} +{{- define "common.utils.fieldToEnvVar" -}} + {{- $fieldNameSplit := splitList "-" .field -}} + {{- $upperCaseFieldNameSplit := list -}} + + {{- range $fieldNameSplit -}} + {{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}} + {{- end -}} + + {{ join "_" $upperCaseFieldNameSplit }} +{{- end -}} + +{{/* +Gets a value from .Values given +Usage: +{{ include "common.utils.getValueFromKey" (dict "key" "path.to.key" "context" $) }} +*/}} +{{- define "common.utils.getValueFromKey" -}} +{{- $splitKey := splitList "." .key -}} +{{- $value := "" -}} +{{- $latestObj := $.context.Values -}} +{{- range $splitKey -}} + {{- if not $latestObj -}} + {{- printf "please review the entire path of '%s' exists in values" $.key | fail -}} + {{- end -}} + {{- $value = ( index $latestObj . ) -}} + {{- $latestObj = $value -}} +{{- end -}} +{{- printf "%v" (default "" $value) -}} +{{- end -}} + +{{/* +Returns first .Values key with a defined value or first of the list if all non-defined +Usage: +{{ include "common.utils.getKeyFromList" (dict "keys" (list "path.to.key1" "path.to.key2") "context" $) }} +*/}} +{{- define "common.utils.getKeyFromList" -}} +{{- $key := first .keys -}} +{{- $reverseKeys := reverse .keys }} +{{- range $reverseKeys }} + {{- $value := include "common.utils.getValueFromKey" (dict "key" . "context" $.context ) }} + {{- if $value -}} + {{- $key = . }} + {{- end -}} +{{- end -}} +{{- printf "%s" $key -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_warnings.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_warnings.tpl new file mode 100644 index 0000000..ae10fa4 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/_warnings.tpl @@ -0,0 +1,14 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Warning about using rolling tag. +Usage: +{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }} +*/}} +{{- define "common.warnings.rollingTag" -}} + +{{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }} +WARNING: Rolling tag detected ({{ .repository }}:{{ .tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. ++info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ +{{- end }} + +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_cassandra.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_cassandra.tpl new file mode 100644 index 0000000..ded1ae3 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_cassandra.tpl @@ -0,0 +1,72 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Cassandra required passwords are not empty. + +Usage: +{{ include "common.validations.values.cassandra.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where Cassandra values are stored, e.g: "cassandra-passwords-secret" + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.cassandra.passwords" -}} + {{- $existingSecret := include "common.cassandra.values.existingSecret" . -}} + {{- $enabled := include "common.cassandra.values.enabled" . -}} + {{- $dbUserPrefix := include "common.cassandra.values.key.dbUser" . -}} + {{- $valueKeyPassword := printf "%s.password" $dbUserPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "cassandra-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.cassandra.values.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.cassandra.dbUser.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.dbUser.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled cassandra. + +Usage: +{{ include "common.cassandra.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.cassandra.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.cassandra.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key dbUser + +Usage: +{{ include "common.cassandra.values.key.dbUser" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether Cassandra is used as subchart or not. Default: false +*/}} +{{- define "common.cassandra.values.key.dbUser" -}} + {{- if .subchart -}} + cassandra.dbUser + {{- else -}} + dbUser + {{- end -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_mariadb.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_mariadb.tpl new file mode 100644 index 0000000..b6906ff --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_mariadb.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MariaDB required passwords are not empty. + +Usage: +{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MariaDB values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mariadb.passwords" -}} + {{- $existingSecret := include "common.mariadb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mariadb.values.enabled" . -}} + {{- $architecture := include "common.mariadb.values.architecture" . -}} + {{- $authPrefix := include "common.mariadb.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mariadb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mariadb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mariadb-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mariadb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mariadb. + +Usage: +{{ include "common.mariadb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mariadb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mariadb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mariadb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mariadb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mariadb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MariaDB is used as subchart or not. Default: false +*/}} +{{- define "common.mariadb.values.key.auth" -}} + {{- if .subchart -}} + mariadb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_mongodb.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_mongodb.tpl new file mode 100644 index 0000000..f820ec1 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_mongodb.tpl @@ -0,0 +1,108 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MongoDB® required passwords are not empty. + +Usage: +{{ include "common.validations.values.mongodb.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MongoDB® values are stored, e.g: "mongodb-passwords-secret" + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mongodb.passwords" -}} + {{- $existingSecret := include "common.mongodb.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mongodb.values.enabled" . -}} + {{- $authPrefix := include "common.mongodb.values.key.auth" . -}} + {{- $architecture := include "common.mongodb.values.architecture" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyDatabase := printf "%s.database" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicaSetKey := printf "%s.replicaSetKey" $authPrefix -}} + {{- $valueKeyAuthEnabled := printf "%s.enabled" $authPrefix -}} + + {{- $authEnabled := include "common.utils.getValueFromKey" (dict "key" $valueKeyAuthEnabled "context" .context) -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") (eq $authEnabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mongodb-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- $valueDatabase := include "common.utils.getValueFromKey" (dict "key" $valueKeyDatabase "context" .context) }} + {{- if and $valueUsername $valueDatabase -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mongodb-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replicaset") -}} + {{- $requiredReplicaSetKey := dict "valueKey" $valueKeyReplicaSetKey "secret" .secret "field" "mongodb-replica-set-key" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicaSetKey -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mongodb.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDb is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mongodb. + +Usage: +{{ include "common.mongodb.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mongodb.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mongodb.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mongodb.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.key.auth" -}} + {{- if .subchart -}} + mongodb.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mongodb.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MongoDB® is used as subchart or not. Default: false +*/}} +{{- define "common.mongodb.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mongodb.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_mysql.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_mysql.tpl new file mode 100644 index 0000000..74472a0 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_mysql.tpl @@ -0,0 +1,103 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate MySQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.mysql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where MySQL values are stored, e.g: "mysql-passwords-secret" + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.mysql.passwords" -}} + {{- $existingSecret := include "common.mysql.values.auth.existingSecret" . -}} + {{- $enabled := include "common.mysql.values.enabled" . -}} + {{- $architecture := include "common.mysql.values.architecture" . -}} + {{- $authPrefix := include "common.mysql.values.key.auth" . -}} + {{- $valueKeyRootPassword := printf "%s.rootPassword" $authPrefix -}} + {{- $valueKeyUsername := printf "%s.username" $authPrefix -}} + {{- $valueKeyPassword := printf "%s.password" $authPrefix -}} + {{- $valueKeyReplicationPassword := printf "%s.replicationPassword" $authPrefix -}} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $requiredRootPassword := dict "valueKey" $valueKeyRootPassword "secret" .secret "field" "mysql-root-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRootPassword -}} + + {{- $valueUsername := include "common.utils.getValueFromKey" (dict "key" $valueKeyUsername "context" .context) }} + {{- if not (empty $valueUsername) -}} + {{- $requiredPassword := dict "valueKey" $valueKeyPassword "secret" .secret "field" "mysql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPassword -}} + {{- end -}} + + {{- if (eq $architecture "replication") -}} + {{- $requiredReplicationPassword := dict "valueKey" $valueKeyReplicationPassword "secret" .secret "field" "mysql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.mysql.values.auth.existingSecret" (dict "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.auth.existingSecret" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.auth.existingSecret | quote -}} + {{- else -}} + {{- .context.Values.auth.existingSecret | quote -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled mysql. + +Usage: +{{ include "common.mysql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.mysql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.mysql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for architecture + +Usage: +{{ include "common.mysql.values.architecture" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.architecture" -}} + {{- if .subchart -}} + {{- .context.Values.mysql.architecture -}} + {{- else -}} + {{- .context.Values.architecture -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key auth + +Usage: +{{ include "common.mysql.values.key.auth" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether MySQL is used as subchart or not. Default: false +*/}} +{{- define "common.mysql.values.key.auth" -}} + {{- if .subchart -}} + mysql.auth + {{- else -}} + auth + {{- end -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_postgresql.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_postgresql.tpl new file mode 100644 index 0000000..164ec0d --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_postgresql.tpl @@ -0,0 +1,129 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate PostgreSQL required passwords are not empty. + +Usage: +{{ include "common.validations.values.postgresql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where postgresql values are stored, e.g: "postgresql-passwords-secret" + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.postgresql.passwords" -}} + {{- $existingSecret := include "common.postgresql.values.existingSecret" . -}} + {{- $enabled := include "common.postgresql.values.enabled" . -}} + {{- $valueKeyPostgresqlPassword := include "common.postgresql.values.key.postgressPassword" . -}} + {{- $valueKeyPostgresqlReplicationEnabled := include "common.postgresql.values.key.replicationPassword" . -}} + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + {{- $requiredPostgresqlPassword := dict "valueKey" $valueKeyPostgresqlPassword "secret" .secret "field" "postgresql-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlPassword -}} + + {{- $enabledReplication := include "common.postgresql.values.enabled.replication" . -}} + {{- if (eq $enabledReplication "true") -}} + {{- $requiredPostgresqlReplicationPassword := dict "valueKey" $valueKeyPostgresqlReplicationEnabled "secret" .secret "field" "postgresql-replication-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlReplicationPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to decide whether evaluate global values. + +Usage: +{{ include "common.postgresql.values.use.global" (dict "key" "key-of-global" "context" $) }} +Params: + - key - String - Required. Field to be evaluated within global, e.g: "existingSecret" +*/}} +{{- define "common.postgresql.values.use.global" -}} + {{- if .context.Values.global -}} + {{- if .context.Values.global.postgresql -}} + {{- index .context.Values.global.postgresql .key | quote -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for existingSecret. + +Usage: +{{ include "common.postgresql.values.existingSecret" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.existingSecret" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "existingSecret" "context" .context) -}} + + {{- if .subchart -}} + {{- default (.context.Values.postgresql.existingSecret | quote) $globalValue -}} + {{- else -}} + {{- default (.context.Values.existingSecret | quote) $globalValue -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled postgresql. + +Usage: +{{ include "common.postgresql.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.postgresql.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key postgressPassword. + +Usage: +{{ include "common.postgresql.values.key.postgressPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.postgressPassword" -}} + {{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "postgresqlUsername" "context" .context) -}} + + {{- if not $globalValue -}} + {{- if .subchart -}} + postgresql.postgresqlPassword + {{- else -}} + postgresqlPassword + {{- end -}} + {{- else -}} + global.postgresql.postgresqlPassword + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled.replication. + +Usage: +{{ include "common.postgresql.values.enabled.replication" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.enabled.replication" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.postgresql.replication.enabled -}} + {{- else -}} + {{- printf "%v" .context.Values.replication.enabled -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for the key replication.password. + +Usage: +{{ include "common.postgresql.values.key.replicationPassword" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false +*/}} +{{- define "common.postgresql.values.key.replicationPassword" -}} + {{- if .subchart -}} + postgresql.replication.password + {{- else -}} + replication.password + {{- end -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_redis.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_redis.tpl new file mode 100644 index 0000000..dcccfc1 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_redis.tpl @@ -0,0 +1,76 @@ + +{{/* vim: set filetype=mustache: */}} +{{/* +Validate Redis® required passwords are not empty. + +Usage: +{{ include "common.validations.values.redis.passwords" (dict "secret" "secretName" "subchart" false "context" $) }} +Params: + - secret - String - Required. Name of the secret where redis values are stored, e.g: "redis-passwords-secret" + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.validations.values.redis.passwords" -}} + {{- $enabled := include "common.redis.values.enabled" . -}} + {{- $valueKeyPrefix := include "common.redis.values.keys.prefix" . -}} + {{- $standarizedVersion := include "common.redis.values.standarized.version" . }} + + {{- $existingSecret := ternary (printf "%s%s" $valueKeyPrefix "auth.existingSecret") (printf "%s%s" $valueKeyPrefix "existingSecret") (eq $standarizedVersion "true") }} + {{- $existingSecretValue := include "common.utils.getValueFromKey" (dict "key" $existingSecret "context" .context) }} + + {{- $valueKeyRedisPassword := ternary (printf "%s%s" $valueKeyPrefix "auth.password") (printf "%s%s" $valueKeyPrefix "password") (eq $standarizedVersion "true") }} + {{- $valueKeyRedisUseAuth := ternary (printf "%s%s" $valueKeyPrefix "auth.enabled") (printf "%s%s" $valueKeyPrefix "usePassword") (eq $standarizedVersion "true") }} + + {{- if and (or (not $existingSecret) (eq $existingSecret "\"\"")) (eq $enabled "true") -}} + {{- $requiredPasswords := list -}} + + {{- $useAuth := include "common.utils.getValueFromKey" (dict "key" $valueKeyRedisUseAuth "context" .context) -}} + {{- if eq $useAuth "true" -}} + {{- $requiredRedisPassword := dict "valueKey" $valueKeyRedisPassword "secret" .secret "field" "redis-password" -}} + {{- $requiredPasswords = append $requiredPasswords $requiredRedisPassword -}} + {{- end -}} + + {{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right value for enabled redis. + +Usage: +{{ include "common.redis.values.enabled" (dict "context" $) }} +*/}} +{{- define "common.redis.values.enabled" -}} + {{- if .subchart -}} + {{- printf "%v" .context.Values.redis.enabled -}} + {{- else -}} + {{- printf "%v" (not .context.Values.enabled) -}} + {{- end -}} +{{- end -}} + +{{/* +Auxiliary function to get the right prefix path for the values + +Usage: +{{ include "common.redis.values.key.prefix" (dict "subchart" "true" "context" $) }} +Params: + - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false +*/}} +{{- define "common.redis.values.keys.prefix" -}} + {{- if .subchart -}}redis.{{- else -}}{{- end -}} +{{- end -}} + +{{/* +Checks whether the redis chart's includes the standarizations (version >= 14) + +Usage: +{{ include "common.redis.values.standarized.version" (dict "context" $) }} +*/}} +{{- define "common.redis.values.standarized.version" -}} + + {{- $standarizedAuth := printf "%s%s" (include "common.redis.values.keys.prefix" .) "auth" -}} + {{- $standarizedAuthValues := include "common.utils.getValueFromKey" (dict "key" $standarizedAuth "context" .context) }} + + {{- if $standarizedAuthValues -}} + {{- true -}} + {{- end -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_validations.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_validations.tpl new file mode 100644 index 0000000..9a814cf --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/templates/validations/_validations.tpl @@ -0,0 +1,46 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Validate values must not be empty. + +Usage: +{{- $validateValueConf00 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-00") -}} +{{- $validateValueConf01 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-01") -}} +{{ include "common.validations.values.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" +*/}} +{{- define "common.validations.values.multiple.empty" -}} + {{- range .required -}} + {{- include "common.validations.values.single.empty" (dict "valueKey" .valueKey "secret" .secret "field" .field "context" $.context) -}} + {{- end -}} +{{- end -}} + +{{/* +Validate a value must not be empty. + +Usage: +{{ include "common.validations.value.empty" (dict "valueKey" "mariadb.password" "secret" "secretName" "field" "my-password" "subchart" "subchart" "context" $) }} + +Validate value params: + - valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password" + - secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret" + - field - String - Optional. Name of the field in the secret data, e.g: "mysql-password" + - subchart - String - Optional - Name of the subchart that the validated password is part of. +*/}} +{{- define "common.validations.values.single.empty" -}} + {{- $value := include "common.utils.getValueFromKey" (dict "key" .valueKey "context" .context) }} + {{- $subchart := ternary "" (printf "%s." .subchart) (empty .subchart) }} + + {{- if not $value -}} + {{- $varname := "my-value" -}} + {{- $getCurrentValue := "" -}} + {{- if and .secret .field -}} + {{- $varname = include "common.utils.fieldToEnvVar" . -}} + {{- $getCurrentValue = printf " To get the current value:\n\n %s\n" (include "common.utils.secret.getvalue" .) -}} + {{- end -}} + {{- printf "\n '%s' must not be empty, please add '--set %s%s=$%s' to the command.%s" .valueKey $subchart .valueKey $varname $getCurrentValue -}} + {{- end -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/values.yaml b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/values.yaml new file mode 100644 index 0000000..f2df68e --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/charts/common/values.yaml @@ -0,0 +1,5 @@ +## bitnami/common +## It is required by CI/CD tools and processes. +## @skip exampleValue +## +exampleValue: common-chart diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-activemq.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-activemq.tpl new file mode 100644 index 0000000..3ce7156 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-activemq.tpl @@ -0,0 +1,17 @@ +{{- define "activemq.env" -}} +- name: ACTIVEMQ_URL + value: $(BROKER_URL) +- name: ACTIVEMQ_USER + value: $(BROKER_USERNAME) +- name: ACTIVEMQ_PASSWORD + value: $(BROKER_PASSWORD) +{{- end -}} + +{{- define "spring.activemq.env" -}} +- name: SPRING_ACTIVEMQ_BROKERURL + value: $(BROKER_URL) +- name: SPRING_ACTIVEMQ_USER + value: $(BROKER_USERNAME) +- name: SPRING_ACTIVEMQ_PASSWORD + value: $(BROKER_PASSWORD) +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-image-pull-secrets.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-image-pull-secrets.tpl new file mode 100644 index 0000000..1260536 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-image-pull-secrets.tpl @@ -0,0 +1,6 @@ +{{- define "alfresco-content-services.imagePullSecrets" }} +{{- if .Values.global.alfrescoRegistryPullSecrets }} +imagePullSecrets: + - name: {{ .Values.global.alfrescoRegistryPullSecrets }} +{{- end }} +{{- end }} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-persistence.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-persistence.tpl new file mode 100644 index 0000000..d473d05 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-persistence.tpl @@ -0,0 +1,41 @@ +{{- define "data_volume" -}} +- name: data +{{- $svc_name := .service.name }} +{{- with .persistence }} +{{- if .enabled }} +{{- $sc_name := .storageClass | default "default" }} + persistentVolumeClaim: + claimName: >- + {{ .existingClaim | default (printf "%s-%s-pvc" $svc_name $sc_name ) }} +{{- else }} + emptyDir: + sizeLimit: {{ .baseSize | default "20Gi" | quote }} +{{- end }} +{{- end }} +{{- end -}} + +{{- define "component_pvc" -}} +{{ $svc_name := .service.name }} +{{- with .persistence }} +{{- $sc_name := .storageClass | default "default" -}} +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ printf "%s-%s-pvc" $svc_name $sc_name }} +spec: + {{- if .storageClass }} + storageClassName: {{ .storageClass | quote }} + {{- end }} + {{- if .accessModes }} + accessModes: + {{- range .accessModes }} + - {{ . }} + {{- end }} + {{- end }} + volumeMode: {{ .volumeMode | default "Filesystem" }} + resources: + requests: + storage: {{ .baseSize | default "20Gi" | quote }} +{{- end }} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-search.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-search.tpl new file mode 100644 index 0000000..7f24d8b --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-search.tpl @@ -0,0 +1,17 @@ +{{/* +Get Alfresco Solr context +*/}} +{{- define "alfresco-search.baseurl" -}} +{{- if index $.Values "alfresco-search" "enabled" -}} + /solr +{{- else -}} + {{ index $.Values "alfresco-search" "external" "context" | default "/solr" -}} +{{- end -}} +{{- end -}} + +{{/* +Required Solr secret +*/}} +{{- define "tracking-shared-secret" -}} + {{- required "You need to provide a shared secret for Solr/repo authentication , see https://github.com/Alfresco/acs-deployment/tree/master/docs/helm" .Values.global.tracking.sharedsecret -}} +{{- end }} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-security.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-security.tpl new file mode 100644 index 0000000..8829e4e --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers-security.tpl @@ -0,0 +1,32 @@ +{{- define "default-pod-security-context" }} + runAsNonRoot: true + runAsUser: 33099 + fsGroupChangePolicy: OnRootMismatch +{{- end }} + +{{- define "default-security-context" }} + runAsNonRoot: true + allowPrivilegeEscalation: false + capabilities: + drop: + - NET_RAW + - ALL +{{- end }} + +{{- define "component-pod-security-context" }} + securityContext: +{{- if .podSecurityContext }} + {{- .podSecurityContext | toYaml | nindent 4 }} +{{- else }} +{{- include "default-pod-security-context" . }} +{{- end }} +{{- end }} + +{{- define "component-security-context" }} + securityContext: +{{- if .securityContext }} + {{- .securityContext | toYaml | nindent 4 }} +{{- else }} +{{- include "default-security-context" . }} +{{- end }} +{{- end }} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers.tpl new file mode 100644 index 0000000..7ae7d58 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/templates/_helpers.tpl @@ -0,0 +1,9 @@ +{{- define "content-services.shortname" -}} +{{- $name := (.Values.NameOverride | default "alfresco-cs") -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "alfresco.shortname" -}} +{{- $name := (.Values.NameOverride | default "alfresco-") -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/values.yaml b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-common/values.yaml new file mode 100644 index 0000000..e69de29 diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.lock b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.lock new file mode 100644 index 0000000..c15cb89 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: alfresco-common + repository: https://alfresco.github.io/alfresco-helm-charts/ + version: 2.0.0 +digest: sha256:04d458edc1a42ae7a4e4bc73d5872cc5cab9ef5960e5b6226af605a661bff71f +generated: "2023-03-09T11:31:57.561169+01:00" diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.yaml b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.yaml new file mode 100644 index 0000000..8596ebb --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/Chart.yaml @@ -0,0 +1,18 @@ +apiVersion: v2 +appVersion: 2.0.6 +dependencies: +- name: alfresco-common + repository: https://alfresco.github.io/alfresco-helm-charts/ + version: 2.0.0 +description: A Helm chart for deploying Alfresco Insight Zeppelin +home: https://www.alfresco.com +icon: https://avatars0.githubusercontent.com/u/391127?s=200&v=4 +keywords: +- zeppelin +- insight zeppelin +- alfresco zeppelin +- alfresco insight zeppelin +name: alfresco-insight-zeppelin +sources: +- https://github.com/Alfresco/alfresco-helm-charts +version: 2.0.0 diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md new file mode 100644 index 0000000..324d3d5 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md @@ -0,0 +1,52 @@ +# alfresco-insight-zeppelin + +![Version: 2.0.0](https://img.shields.io/badge/Version-2.0.0-informational?style=flat-square) ![AppVersion: 2.0.6](https://img.shields.io/badge/AppVersion-2.0.6-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. + +**Homepage:** + +## Source Code + +* + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 2.0.0 | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| 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) | +| global.strategy.rollingUpdate.maxSurge | int | `1` | | +| global.strategy.rollingUpdate.maxUnavailable | int | `0` | | +| image.internalPort | int | `9090` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"quay.io/alfresco/insight-zeppelin"` | | +| image.tag | string | `"2.0.6"` | | +| ingress.path | string | `"/zeppelin"` | | +| livenessProbe.initialDelaySeconds | int | `130` | | +| livenessProbe.periodSeconds | int | `20` | | +| livenessProbe.timeoutSeconds | int | `10` | | +| nodeSelector | object | `{}` | | +| podSecurityContext.runAsNonRoot | bool | `true` | | +| podSecurityContext.runAsUser | int | `33007` | | +| readinessProbe.initialDelaySeconds | int | `60` | | +| readinessProbe.periodSeconds | int | `20` | | +| readinessProbe.timeoutSeconds | int | `10` | | +| replicaCount | int | `1` | Define the alfresco-insight-zeppelin properties to use in the k8s cluster This is chart will be installed as part of Alfresco Insight Engine | +| repository | object | `{}` | The parent chart will set the values for "repository.host" and "repository.port" | +| resources.limits.cpu | string | `"1"` | | +| resources.limits.memory | string | `"1024Mi"` | | +| resources.requests.cpu | string | `"0.5"` | | +| resources.requests.memory | string | `"512Mi"` | | +| service.externalPort | int | `80` | | +| service.name | string | `"zeppelin"` | | +| service.type | string | `"ClusterIP"` | | diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md.gotmpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md.gotmpl new file mode 100644 index 0000000..b301f39 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/README.md.gotmpl @@ -0,0 +1,18 @@ +{{ template "chart.header" . }} +{{ template "chart.deprecationWarning" . }} + +{{ template "chart.badgesSection" . }} + +{{ 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. + +{{ template "chart.homepageLine" . }} + +{{ template "chart.maintainersSection" . }} + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.requirementsSection" . }} + +{{ template "chart.valuesSection" . }} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/_helpers.tpl b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/_helpers.tpl new file mode 100644 index 0000000..afbaf81 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/_helpers.tpl @@ -0,0 +1,28 @@ +{{/* +Get Alfresco Insight Zeppelin Full Name +*/}} +{{- define "alfresco-insight-zeppelin.fullName" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Get Alfresco Zeppelin Host +*/}} +{{- define "alfresco-insight-zeppelin.host" -}} +{{- printf "%s-%s" .Release.Name "alfresco-insight-zeppelin" -}} +{{- end -}} + +{{/* +Get Alfresco Repo Host +*/}} +{{- define "alfresco-repo-host" -}} +{{- .Values.repository.host | default (printf "%s-repository" (include "content-services.shortname" $)) }} +{{- end -}} + +{{/* +Get Alfresco Repo Port +*/}} +{{- define "alfresco-repo-port" -}} +{{- .Values.repository.port | default 80 }} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/config.yaml b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/config.yaml new file mode 100644 index 0000000..ef73c5d --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/config.yaml @@ -0,0 +1,17 @@ +--- +# Defines the config for the Alfresco Insight Zeppelin App +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "alfresco-insight-zeppelin.fullName" . }}-configmap + labels: + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + component: zeppelin +data: + REPO_HOST: "{{ template "alfresco-repo-host" . }}" + REPO_PORT: "{{ template "alfresco-repo-port" . }}" + {{- range $key, $value := .Values.environment }} + {{ $key }}: {{ $value }} + {{- end }} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/deployment.yaml b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/deployment.yaml new file mode 100644 index 0000000..952811c --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/deployment.yaml @@ -0,0 +1,58 @@ +--- +# Defines the deployment for the Alfresco Insight Zeppelin App +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "alfresco-insight-zeppelin.fullName" . }} + labels: + app: {{ template "alfresco-insight-zeppelin.fullName" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + component: zeppelin +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "alfresco-insight-zeppelin.fullName" . }} + release: {{ .Release.Name }} + strategy: + type: RollingUpdate + rollingUpdate: {{- toYaml .Values.global.strategy.rollingUpdate | nindent 6 }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} + labels: + app: {{ template "alfresco-insight-zeppelin.fullName" . }} + release: {{ .Release.Name }} + 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 }} + 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 + ports: + - containerPort: {{ .Values.image.internalPort }} + readinessProbe: + httpGet: + path: /zeppelin + port: {{ .Values.image.internalPort }} + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + livenessProbe: + httpGet: + path: /zeppelin + port: {{ .Values.image.internalPort }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/ingress.yaml b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/ingress.yaml new file mode 100644 index 0000000..48a7d6a --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/ingress.yaml @@ -0,0 +1,17 @@ +{{- $serviceName := (include "alfresco-insight-zeppelin.fullName" .) -}} +{{- $servicePort := .Values.service.externalPort -}} +apiVersion: {{ template "common.capabilities.ingress.apiVersion" . }} +kind: Ingress +metadata: + name: {{ template "alfresco-insight-zeppelin.fullName" . }} + annotations: + kubernetes.io/ingress.class: "nginx" +spec: + rules: + - http: + paths: + - path: {{ .Values.ingress.path }} + {{- if eq "true" (include "common.ingress.supportsPathType" .) }} + pathType: Prefix + {{- end }} + backend: {{- include "common.ingress.backend" (dict "serviceName" $serviceName "servicePort" $servicePort "context" $) | nindent 10 }} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/service.yaml b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/service.yaml new file mode 100644 index 0000000..f69bc5b --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/templates/service.yaml @@ -0,0 +1,20 @@ +--- +# Defines the service for the Alfresco Insight Zeppelin App +apiVersion: v1 +kind: Service +metadata: + name: {{ template "alfresco-insight-zeppelin.fullName" . }} + labels: + app: {{ template "alfresco-insight-zeppelin.fullName" . }}-app + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.image.internalPort }} + name: {{ .Values.service.name }} + selector: + app: {{ template "alfresco-insight-zeppelin.fullName" . }} + release: {{ .Release.Name }} diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/config_test.yaml b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/config_test.yaml new file mode 100644 index 0000000..cc6efd0 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/config_test.yaml @@ -0,0 +1,30 @@ +--- +suite: test configmaps +templates: + - config.yaml +tests: + - it: should have default port and hosts + asserts: + - equal: + path: data.REPO_HOST + value: RELEASE-NAME-alfresco-cs-repository + template: config.yaml + - equal: + path: data.REPO_PORT + value: "80" + template: config.yaml + + - it: should have provided host and port + set: + repository: + host: somacshost + port: 888 + asserts: + - equal: + path: data.REPO_HOST + value: somacshost + template: config.yaml + - equal: + path: data.REPO_PORT + value: "888" + template: config.yaml diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/deployment_test.yaml b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/deployment_test.yaml new file mode 100644 index 0000000..61da5b9 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/tests/deployment_test.yaml @@ -0,0 +1,23 @@ +--- +suite: test deployment +templates: + - deployment.yaml +tests: + - it: should have basic metadata in place + asserts: + - equal: + path: metadata.name + value: RELEASE-NAME-alfresco-insight-zeppelin + template: deployment.yaml + + - it: should render cpu and memory limits + asserts: + - equal: + path: spec.template.spec.containers[0].resources + value: + requests: + cpu: "0.5" + memory: "512Mi" + limits: + cpu: "1" + memory: "1024Mi" diff --git a/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/values.yaml b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/values.yaml new file mode 100644 index 0000000..caceef5 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/charts/alfresco-insight-zeppelin/values.yaml @@ -0,0 +1,52 @@ +# Default values for alfresco-insight-zeppelin. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# -- Define the alfresco-insight-zeppelin properties to use in the k8s cluster +# This is chart will be installed as part of Alfresco Insight Engine +--- +replicaCount: 1 +nodeSelector: {} +image: + repository: quay.io/alfresco/insight-zeppelin + tag: 2.0.6 + pullPolicy: IfNotPresent + internalPort: 9090 +podSecurityContext: + runAsUser: 33007 + runAsNonRoot: true +service: + name: zeppelin + type: ClusterIP + externalPort: 80 +ingress: + path: /zeppelin +# -- The parent chart will set the values for "repository.host" and +# "repository.port" +repository: {} +resources: + requests: + cpu: "0.5" + memory: "512Mi" + limits: + cpu: "1" + memory: "1024Mi" +readinessProbe: + initialDelaySeconds: 60 + periodSeconds: 20 + timeoutSeconds: 10 +livenessProbe: + initialDelaySeconds: 130 + periodSeconds: 20 + timeoutSeconds: 10 +environment: + ZEPPELIN_MEM: "-Xms512m -Xmx1g" + ZEPPELIN_INTP_MEM: "-Xms512m -Xmx1g" +global: + # -- Global definition of Docker registry pull secret which can be overridden + # from parent ACS Helm chart(s) + alfrescoRegistryPullSecrets: quay-registry-secret + strategy: + rollingUpdate: + maxSurge: 1 + maxUnavailable: 0 diff --git a/alfresco-content-services/charts/alfresco-search-service/ci/default-values.yaml b/alfresco-content-services/charts/alfresco-search-service/ci/default-values.yaml new file mode 100644 index 0000000..33da59f --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/ci/default-values.yaml @@ -0,0 +1,7 @@ +--- +alfresco-insight-zeppelin: + nameOverride: zeppelin + enabled: true +global: + tracking: + sharedsecret: dummy diff --git a/alfresco-content-services/charts/alfresco-search-service/templates/NOTES.txt b/alfresco-content-services/charts/alfresco-search-service/templates/NOTES.txt new file mode 100644 index 0000000..eba650a --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/templates/NOTES.txt @@ -0,0 +1,30 @@ +{{- define "httpTransport" -}} +{{- if .Values.ingress.tls -}} + https +{{- else -}} + http +{{- end -}} +{{- end -}} + +{{- define "httpHost" -}} +{{- if .Values.ingress.tls -}} + {{- with (index .Values.ingress.tls 0) }} + {{- index .hosts 0 }} + {{- end }} +{{- else -}} + clusterhostname.domain.tld +{{- end -}} +{{- end -}} + +You can access Alfresco Search using: +{{- if .Values.ingress.enabled }} + * Solr: {{ template "httpTransport" . }}://{{ template "httpHost" . }}/{{ .Values.ingress.path | default "solr" }} + +{{- with (index .Values "alfresco-insight-zeppelin") }} +{{ if .enabled }} + * Zeppelin: {{ template "httpTransport" (dict "Values" .) }}://{{ template "httpHost" (dict "Values" .) }}/{{ .ingress.path | default "zeppelin" }} +{{ end }} +{{- end }} +{{- else }} + * Solr: http://{{ template "alfresco-search.fullName" . }}-solr:{{ template "alfresco-search.svcPort" . }}/solr +{{- end }} diff --git a/alfresco-content-services/charts/alfresco-search-service/templates/_helpers.tpl b/alfresco-content-services/charts/alfresco-search-service/templates/_helpers.tpl new file mode 100644 index 0000000..85bee69 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/templates/_helpers.tpl @@ -0,0 +1,69 @@ +{{/* +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-search.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 }} + +{{/* +Alfresco Search Service Host +*/}} +{{- define "alfresco-search.host" -}} + {{ printf "%s-solr" (include "alfresco-search.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 -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/templates/config.yaml b/alfresco-content-services/charts/alfresco-search-service/templates/config.yaml new file mode 100644 index 0000000..9838c8b --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/templates/config.yaml @@ -0,0 +1,25 @@ +# Defines the properties required by the Alfresco Search (Solr) App +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "alfresco-search.fullName" . }}-solr-configmap + labels: + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + component: search +data: + SOLR_ALFRESCO_HOST: >- + {{ .Values.repository.host | default (printf "%s-repository" (include "content-services.shortname" $)) }} + SOLR_ALFRESCO_PORT: >- + {{ .Values.repository.port | default 80 }} + SOLR_SOLR_HOST: >- + {{ template "alfresco-search.fullName" . }}-solr + SOLR_SOLR_PORT: >- + {{ .Values.service.externalPort | default 80 }} + ALFRESCO_SECURE_COMMS: >- + {{ .Values.global.tracking.auth | default "secret" }} + {{- $environment := .Values.environment | default dict }} + {{- range $key, $val := $environment }} + {{ $key }}: {{ tpl $val $ | quote }} + {{- end }} diff --git a/alfresco-content-services/charts/alfresco-search-service/templates/deployment.yaml b/alfresco-content-services/charts/alfresco-search-service/templates/deployment.yaml new file mode 100644 index 0000000..12ebef2 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/templates/deployment.yaml @@ -0,0 +1,94 @@ +# Defines the deployment for the Alfresco Search (Solr) App +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "alfresco-search.fullName" . }}-solr + labels: + app: {{ template "alfresco-search.fullName" . }}-solr + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + component: search +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: {{ template "alfresco-search.fullName" . }}-solr + release: {{ .Release.Name }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} + labels: + app: {{ template "alfresco-search.fullName" . }}-solr + release: {{ .Release.Name }} + 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 }} + containers: + - name: {{ .Chart.Name }} + image: {{ template "alfresco-search.dockerImage" . }} + imagePullPolicy: {{ template "alfresco-search.pullPolicy" . }} + {{- include "component-security-context" .Values | indent 8 }} + envFrom: + - configMapRef: + name: {{ template "alfresco-search.fullName" . }}-solr-configmap + {{- if eq .Values.global.tracking.auth "secret" }} + - secretRef: + name: {{ template "alfresco-search.fullName" . }}-solr-jtoolopts + {{- end }} + ports: + - containerPort: {{ template "alfresco-search.containerPort" . }} + resources: {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: data + mountPath: {{ .Values.persistence.search.data.mountPath }} + subPath: {{ .Values.persistence.search.data.subPath }} + readinessProbe: + httpGet: + path: /solr/alfresco/admin/ping + port: {{ template "alfresco-search.containerPort" . }} + {{- if eq .Values.global.tracking.auth "secret" }} + httpHeaders: + - name: X-Alfresco-Search-Secret + value: "{{ .Values.global.tracking.sharedsecret }}" + {{- end }} + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + livenessProbe: + httpGet: + path: /solr/admin/info/system + port: {{ template "alfresco-search.containerPort" . }} + {{- if eq .Values.global.tracking.auth "secret" }} + httpHeaders: + - name: X-Alfresco-Search-Secret + value: "{{ .Values.global.tracking.sharedsecret }}" + {{- end }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + failureThreshold: 1 + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + # sleep to drain any existing connections + lifecycle: + preStop: + exec: + command: ["/bin/bash", "-c", "sleep 10"] + volumes: + - name: data + persistentVolumeClaim: + claimName: |- + {{ .Values.persistence.existingClaim | default (printf "%s-solr-claim" (include "alfresco-search.fullName" .)) }} diff --git a/alfresco-content-services/charts/alfresco-search-service/templates/ingress.yaml b/alfresco-content-services/charts/alfresco-search-service/templates/ingress.yaml new file mode 100644 index 0000000..7d0a687 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/templates/ingress.yaml @@ -0,0 +1,36 @@ +{{- if .Values.ingress.enabled }} +{{- $serviceName := printf "%s-%s" (include "alfresco-search.fullName" .) "solr" -}} +{{- $servicePort := .Values.service.name | default (include "alfresco-search.svcPort" .) -}} +{{- $backendSvc := dict "serviceName" $serviceName "servicePort" $servicePort "context" $ -}} + +apiVersion: {{ template "common.capabilities.ingress.apiVersion" . }} +kind: Ingress +metadata: + name: {{ template "alfresco-search.fullName" . }}-solr + annotations: + kubernetes.io/ingress.class: "nginx" + nginx.ingress.kubernetes.io/auth-type: basic + nginx.ingress.kubernetes.io/auth-secret: {{ $.Values.ingress.existingSecretName | default (printf "%s-ingress-secret" (include "alfresco-search.fullName" $)) }} + nginx.ingress.kubernetes.io/auth-realm: "Authentication Required - Alfresco Search Services" + nginx.ingress.kubernetes.io/whitelist-source-range: {{ .Values.ingress.whitelist_ips }} + +spec: + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + - http: + paths: + - path: {{ .Values.ingress.path }} + {{- if eq "true" (include "common.ingress.supportsPathType" .) }} + pathType: Prefix + {{- end }} + backend: {{- include "common.ingress.backend" $backendSvc | nindent 10 }} +{{- end }} diff --git a/alfresco-content-services/charts/alfresco-search-service/templates/pvc.yaml b/alfresco-content-services/charts/alfresco-search-service/templates/pvc.yaml new file mode 100644 index 0000000..7968eb4 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/templates/pvc.yaml @@ -0,0 +1,49 @@ +{{- if .Values.persistence.enabled -}} +{{- if .Values.persistence.EbsPvConfiguration.volumeID }} +apiVersion: v1 +kind: PersistentVolume +metadata: + name: {{ template "alfresco-search.fullName" . }}-solr-pv + labels: + app: {{ template "alfresco-search.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.fullName" . }}-solr-sc + accessModes: + - "ReadWriteOnce" + {{- with .Values.PvNodeAffinity }} + nodeAffinity: +{{ toYaml . | indent 4 }} + {{- end }} + {{- with .Values.persistence.EbsPvConfiguration }} + awsElasticBlockStore: +{{ toYaml . | indent 4 }} + {{- end }} +--- +{{- end }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ template "alfresco-search.fullName" . }}-solr-claim + labels: + app: {{ template "alfresco-search.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.fullName" . }}-solr-sc + {{- end }} +{{- end -}} diff --git a/alfresco-content-services/charts/alfresco-search-service/templates/secret-ingress.yaml b/alfresco-content-services/charts/alfresco-search-service/templates/secret-ingress.yaml new file mode 100644 index 0000000..bda7480 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/templates/secret-ingress.yaml @@ -0,0 +1,12 @@ +{{- if and (not .Values.ingress.existingSecretName) .Values.ingress.enabled }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "alfresco-search.fullName" . }}-ingress-secret + labels: + app: {{ template "alfresco-search.fullName" . }}-solr + release: {{ .Release.Name }} +type: Opaque +data: + auth: {{ .Values.ingress.basicAuth | quote }} +{{- end }} diff --git a/alfresco-content-services/charts/alfresco-search-service/templates/secret-solr-jtoolopt.yaml b/alfresco-content-services/charts/alfresco-search-service/templates/secret-solr-jtoolopt.yaml new file mode 100644 index 0000000..f77a3de --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/templates/secret-solr-jtoolopt.yaml @@ -0,0 +1,12 @@ +{{- if eq .Values.global.tracking.auth "secret" }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "alfresco-search.fullName" . }}-solr-jtoolopts + labels: + app: {{ template "alfresco-search.fullName" . }}-solr + release: {{ .Release.Name }} +type: Opaque +data: + JAVA_TOOL_OPTIONS: {{ printf "-Dalfresco.secureComms.secret=%s " (include "tracking-shared-secret" .) | b64enc | quote }} +{{- end }} diff --git a/alfresco-content-services/charts/alfresco-search-service/templates/service.yaml b/alfresco-content-services/charts/alfresco-search-service/templates/service.yaml new file mode 100644 index 0000000..1eaedfd --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/templates/service.yaml @@ -0,0 +1,19 @@ +# Defines the service for the Alfresco Search (Solr) App +apiVersion: v1 +kind: Service +metadata: + name: {{ template "alfresco-search.fullName" . }}-solr + labels: + app: {{ template "alfresco-search.fullName" . }}-solr + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ template "alfresco-search.svcPort" . }} + targetPort: {{ template "alfresco-search.containerPort" . }} + name: {{ .Values.service.name }} + selector: + app: {{ template "alfresco-search.fullName" . }}-solr + release: {{ .Release.Name }} diff --git a/alfresco-content-services/charts/alfresco-search-service/tests/config_test.yaml b/alfresco-content-services/charts/alfresco-search-service/tests/config_test.yaml new file mode 100644 index 0000000..1cb4360 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/tests/config_test.yaml @@ -0,0 +1,58 @@ +--- +suite: test search configmap +templates: + - config.yaml +tests: + - it: should contains default env vars + values: &testvalues + - values/test_values.yaml + asserts: + - equal: + path: data.SOLR_ALFRESCO_HOST + value: RELEASE-NAME-alfresco-cs-repository + - equal: + path: data.SOLR_ALFRESCO_PORT + value: "80" + - equal: + path: data.SOLR_SOLR_HOST + value: RELEASE-NAME-alfresco-search-service-solr + - equal: + path: data.SOLR_SOLR_PORT + value: "80" + - equal: + path: data.ALFRESCO_SECURE_COMMS + value: secret + - equal: + path: data.SOLR_CREATE_ALFRESCO_DEFAULTS + value: alfresco,archive + + - it: should contains customized env vars + values: *testvalues + set: + repository: + host: somehost + port: 8888 + environment: + whatever: value + asserts: + - equal: + path: data.SOLR_ALFRESCO_HOST + value: somehost + - equal: + path: data.SOLR_ALFRESCO_PORT + value: "8888" + - equal: + path: data.SOLR_SOLR_HOST + value: RELEASE-NAME-alfresco-search-service-solr + - equal: + path: data.SOLR_SOLR_PORT + value: "80" + - equal: + path: data.ALFRESCO_SECURE_COMMS + value: secret + - equal: + path: data.SOLR_CREATE_ALFRESCO_DEFAULTS + value: alfresco,archive + - equal: + path: data.whatever + value: value diff --git a/alfresco-content-services/charts/alfresco-search-service/tests/deployment_test.yaml b/alfresco-content-services/charts/alfresco-search-service/tests/deployment_test.yaml new file mode 100644 index 0000000..5ece41e --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/tests/deployment_test.yaml @@ -0,0 +1,28 @@ +--- +suite: test solr deployment +templates: + - deployment.yaml + - config.yaml +tests: + - it: should have basic metadata in place + values: &testvalues + - values/test_values.yaml + asserts: + - equal: + path: metadata.name + value: RELEASE-NAME-alfresco-search-service-solr + template: deployment.yaml + + - it: should render cpu and memory limits + values: *testvalues + asserts: + - equal: + path: spec.template.spec.containers[0].resources + value: + requests: + cpu: "0.50" + memory: "1200Mi" + limits: + cpu: "4" + memory: "2000Mi" + template: deployment.yaml diff --git a/alfresco-content-services/charts/alfresco-search-service/tests/ingress_test.yaml b/alfresco-content-services/charts/alfresco-search-service/tests/ingress_test.yaml new file mode 100644 index 0000000..95f5a99 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/tests/ingress_test.yaml @@ -0,0 +1,33 @@ +--- +suite: test ingress +templates: + - ingress.yaml +tests: + - it: should have basic metadata in place + values: &testvalues + - values/test_values.yaml + - values/ingress.yaml + asserts: + - equal: + path: metadata.name + value: RELEASE-NAME-alfresco-search-service-solr + template: ingress.yaml + + - it: should reference the default secret with default values + values: *testvalues + asserts: + - equal: + path: metadata.annotations.nginx\.ingress\.kubernetes\.io/auth-secret + value: RELEASE-NAME-alfresco-search-service-ingress-secret + template: ingress.yaml + + - it: should reference the existing secret when ingress.existingSecretName is set + values: *testvalues + set: + ingress: + 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/alfresco-content-services/charts/alfresco-search-service/tests/resources_test.yaml b/alfresco-content-services/charts/alfresco-search-service/tests/resources_test.yaml new file mode 100644 index 0000000..4e530de --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/tests/resources_test.yaml @@ -0,0 +1,26 @@ +--- +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/alfresco-content-services/charts/alfresco-search-service/tests/secret-ingress_test.yaml b/alfresco-content-services/charts/alfresco-search-service/tests/secret-ingress_test.yaml new file mode 100644 index 0000000..e4ddb06 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/tests/secret-ingress_test.yaml @@ -0,0 +1,34 @@ +--- +suite: test solr ingress secret +templates: + - secret-ingress.yaml +tests: + - it: should have credentials in the ingress secret + values: &testvalues + - values/test_values.yaml + - values/ingress.yaml + asserts: + - equal: + path: data.auth + value: YWRtaW46JGFwcjEkVVJqb29uS00kSEMuS1EwVkRScFpwSHB2a3JwTDd1Lg== + template: secret-ingress.yaml + + - it: should not render ingress secret when ingress is disabled + values: *testvalues + set: + ingress: + enabled: false + asserts: + - hasDocuments: + count: 0 + template: secret-ingress.yaml + + - it: should not render ingress secret when and existing secret name is set + values: *testvalues + set: + ingress: + existingSecretName: my-custom-secret + asserts: + - hasDocuments: + count: 0 + template: secret-ingress.yaml diff --git a/alfresco-content-services/charts/alfresco-search-service/tests/secret-solr-jtoolopt_test.yaml b/alfresco-content-services/charts/alfresco-search-service/tests/secret-solr-jtoolopt_test.yaml new file mode 100644 index 0000000..afa188f --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/tests/secret-solr-jtoolopt_test.yaml @@ -0,0 +1,22 @@ +--- +suite: test solr java_tool_options secret +templates: + - secret-solr-jtoolopt.yaml +tests: + - it: should have credentials in the ingress secret + values: &testvalues + - values/test_values.yaml + asserts: + - equal: + path: data.JAVA_TOOL_OPTIONS + value: LURhbGZyZXNjby5zZWN1cmVDb21tcy5zZWNyZXQ9ZHVtbXkg + template: secret-solr-jtoolopt.yaml + + - it: should not render ingress secret when ingress is disabled + values: *testvalues + set: + global.tracking.auth: none + asserts: + - hasDocuments: + count: 0 + template: secret-solr-jtoolopt.yaml diff --git a/alfresco-content-services/charts/alfresco-search-service/tests/values/ingress.yaml b/alfresco-content-services/charts/alfresco-search-service/tests/values/ingress.yaml new file mode 100644 index 0000000..b64f5f5 --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/tests/values/ingress.yaml @@ -0,0 +1,4 @@ +--- +ingress: + enabled: true + basicAuth: YWRtaW46JGFwcjEkVVJqb29uS00kSEMuS1EwVkRScFpwSHB2a3JwTDd1Lg== diff --git a/alfresco-content-services/charts/alfresco-search-service/tests/values/test_values.yaml b/alfresco-content-services/charts/alfresco-search-service/tests/values/test_values.yaml new file mode 100644 index 0000000..6968a5a --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/tests/values/test_values.yaml @@ -0,0 +1,5 @@ +--- +global: + tracking: + sharedsecret: dummy + alfrescoRegistryPullSecrets: secretsecret diff --git a/alfresco-content-services/charts/alfresco-search-service/values.yaml b/alfresco-content-services/charts/alfresco-search-service/values.yaml new file mode 100644 index 0000000..5312d0e --- /dev/null +++ b/alfresco-content-services/charts/alfresco-search-service/values.yaml @@ -0,0 +1,146 @@ +--- +# -- 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 +# --set alfresco-search.type=insight-engine +# --set alfresco-search.global.alfrescoRegistryPullSecrets=quay-registry-secret +# --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 +type: search-services +podSecurityContext: + runAsNonRoot: true + runAsUser: 33007 + runAsGroup: 33007 + fsGroup: 33007 +searchServicesImage: + repository: quay.io/alfresco/search-services + tag: 2.0.7 + pullPolicy: &searchDockerImagePullPolicy IfNotPresent + # -- container's port search service is listening on + # change if your custom image use a different port. + internalPort: +insightEngineImage: + repository: quay.io/alfresco/insight-engine + tag: 2.0.7 + pullPolicy: *searchDockerImagePullPolicy + # -- container's port search service is listening on + # change if your custom image use a different port. + internalPort: +service: + name: solr + type: ClusterIP + # -- Should you want to change the service port + # externalPort: 80 +ingress: + # -- Expose the solr admin console behind basic auth + enabled: false + path: /solr + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + + # -- Default solr basic auth user/password: admin / admin + # You can create your own with htpasswd utilility & encode it with base640. + # Example: `echo -n "$(htpasswd -nbm admin admin)" | base64 | tr -d '\n'` + # basicAuth: YWRtaW46JGFwcjEkVVJqb29uS00kSEMuS1EwVkRScFpwSHB2a3JwTDd1Lg== + basicAuth: + # -- An existing secret that contains an `auth` key with a value in the same + # format of `ingress.basicAuth` + existingSecretName: + # -- Comma separated list of CIDR to restrict search endpoint access. + whitelist_ips: 0.0.0.0/0 +# Below values must be set by parent chart +repository: + # -- ACS repository hostname + host: + # -- ACS repository port + port: +environment: + SOLR_CREATE_ALFRESCO_DEFAULTS: alfresco,archive +resources: + requests: + cpu: "0.50" + memory: "1200Mi" + limits: + cpu: "4" + memory: "2000Mi" +# -- Defines the persistence +persistence: + # -- If set to false data will be lost with pods + enabled: true + # -- Only define if you have a specific claim already created + # existingClaim: "search-master-claim" + VolumeSizeRequest: 10Gi + 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 + timeoutSeconds: 10 +livenessProbe: + initialDelaySeconds: 130 + periodSeconds: 20 + timeoutSeconds: 10 + +initContainer: + image: + repository: busybox + tag: 1.35.0 + pullPolicy: IfNotPresent + resources: + requests: + memory: "5Mi" + limits: + memory: "10Mi" + +global: + tracking: + # -- Select how solr and repo authenticate to each other + # none: work only prior to acs 7.2 (and was the default) + # secret: use a shared secret (to specify using `tracking.sharedsecret`) + # https: to use mTLS auth (require appropriate certificate configuration) + auth: secret + # -- Shared secret to authenticate repo/solr traffic + sharedsecret: null + alfrescoRegistryPullSecrets: quay-registry-secret + +# -- Define Affinity for scheduling SOLR +affinity: +# nodeAffinity: +# requiredDuringSchedulingIgnoredDuringExecution: +# nodeSelectorTerms: +# - matchExpressions: +# - key: "SolrMasterOnly" +# operator: In +# values: +# - "true" + +# -- Define Tolerations for scheduling SOLR +tolerations: +# - key: "SolrMasterOnly" +# operator: "Equal" +# value: "true" +# effect: "NoSchedule" + +# -- Define PVNodeAffinity for scheduling SOLR +PvNodeAffinity: +# required: +# nodeSelectorTerms: +# - matchExpressions: +# - key: "SolrMasterOnly" +# operator: In +# values: +# - "true"