From 1da91cd07bc6a8dbec870ca53ae1939b2b0bcbf5 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Wed, 20 Nov 2024 10:12:41 +0100 Subject: [PATCH 1/3] Configurable init containers --- charts/alfresco-connector-hxi/Chart.yaml | 2 +- charts/alfresco-connector-hxi/README.md | 7 +++++-- .../templates/job-connector-hxi-bulk-ingester.yaml | 3 ++- charts/alfresco-connector-hxi/values.yaml | 8 ++++++-- charts/alfresco-repository/Chart.yaml | 2 +- charts/alfresco-repository/README.md | 7 ++++++- charts/alfresco-repository/templates/deployment.yaml | 8 +++----- charts/alfresco-repository/values.yaml | 10 ++++++++++ charts/alfresco-search-enterprise/Chart.yaml | 2 +- charts/alfresco-search-enterprise/README.md | 7 +++++-- .../templates/reindexing-job.yaml | 3 ++- charts/alfresco-search-enterprise/values.yaml | 8 ++++++-- 12 files changed, 48 insertions(+), 19 deletions(-) diff --git a/charts/alfresco-connector-hxi/Chart.yaml b/charts/alfresco-connector-hxi/Chart.yaml index e81aa6288..385b9cb4d 100644 --- a/charts/alfresco-connector-hxi/Chart.yaml +++ b/charts/alfresco-connector-hxi/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: alfresco-connector-hxi description: A Helm chart for deploying Alfresco connector hxi services type: application -version: 0.1.0-alpha.2 +version: 0.1.0-alpha.3 appVersion: 1.0.0 dependencies: - name: alfresco-common diff --git a/charts/alfresco-connector-hxi/README.md b/charts/alfresco-connector-hxi/README.md index d8d3e0502..ee680723a 100644 --- a/charts/alfresco-connector-hxi/README.md +++ b/charts/alfresco-connector-hxi/README.md @@ -5,7 +5,7 @@ parent: Charts Reference # alfresco-connector-hxi -![Version: 0.1.0-alpha.2](https://img.shields.io/badge/Version-0.1.0--alpha.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) +![Version: 0.1.0-alpha.3](https://img.shields.io/badge/Version-0.1.0--alpha.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) A Helm chart for deploying Alfresco connector hxi services @@ -34,7 +34,10 @@ Checkout [alfresco-content-services chart's doc](https://github.com/Alfresco/acs | bulkIngester.image.pullPolicy | string | `"IfNotPresent"` | | | bulkIngester.image.repository | string | `"quay.io/alfresco/alfresco-hxinsight-connector-bulk-ingester"` | | | bulkIngester.image.tag | string | `"1.0.0-A13"` | | -| bulkIngester.initContainers.waitForRepository.resources.limits.cpu | string | `"0.25"` | | +| bulkIngester.initContainers.waitForRepository.image.pullPolicy | string | `"IfNotPresent"` | | +| bulkIngester.initContainers.waitForRepository.image.repository | string | `"curlimages/curl"` | | +| bulkIngester.initContainers.waitForRepository.image.tag | string | `"8.11.0"` | | +| bulkIngester.initContainers.waitForRepository.resources.limits.cpu | string | `"250m"` | | | bulkIngester.initContainers.waitForRepository.resources.limits.memory | string | `"20Mi"` | | | bulkIngester.resources.limits.cpu | string | `"2"` | | | bulkIngester.resources.limits.memory | string | `"512Mi"` | | diff --git a/charts/alfresco-connector-hxi/templates/job-connector-hxi-bulk-ingester.yaml b/charts/alfresco-connector-hxi/templates/job-connector-hxi-bulk-ingester.yaml index 838706fd5..9ede39a94 100644 --- a/charts/alfresco-connector-hxi/templates/job-connector-hxi-bulk-ingester.yaml +++ b/charts/alfresco-connector-hxi/templates/job-connector-hxi-bulk-ingester.yaml @@ -42,7 +42,8 @@ spec: protocol: TCP initContainers: - name: wait-for-repository - image: curlimages/curl:7.79.1 + image: {{ printf "%s:%s" .Values.bulkIngester.initContainers.waitForRepository.image.repository .Values.bulkIngester.initContainers.waitForRepository.image.tag | quote }} + imagePullPolicy: {{ .Values.bulkIngester.initContainers.waitForRepository.image.pullPolicy }} {{- include "alfresco-common.component-security-context" .Values | indent 8 }} resources: {{- toYaml .Values.bulkIngester.initContainers.waitForRepository.resources | nindent 12 }} env: diff --git a/charts/alfresco-connector-hxi/values.yaml b/charts/alfresco-connector-hxi/values.yaml index d936f6342..492e448cc 100644 --- a/charts/alfresco-connector-hxi/values.yaml +++ b/charts/alfresco-connector-hxi/values.yaml @@ -99,10 +99,14 @@ bulkIngester: ALFRESCO_BULK_INGEST_PUBLISHER_ENDPOINT: activemq:queue:bulk-ingester-events initContainers: waitForRepository: + image: + repository: curlimages/curl + tag: "8.11.0" + pullPolicy: IfNotPresent resources: limits: - cpu: "0.25" - memory: "20Mi" + cpu: 250m + memory: 20Mi affinity: {} predictionApplier: enabled: true diff --git a/charts/alfresco-repository/Chart.yaml b/charts/alfresco-repository/Chart.yaml index fbcab6189..fbd7494e5 100644 --- a/charts/alfresco-repository/Chart.yaml +++ b/charts/alfresco-repository/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: alfresco-repository description: Alfresco content repository Helm chart type: application -version: 0.7.2 +version: 0.8.0-alpha.0 appVersion: 23.3.2 dependencies: - name: alfresco-common diff --git a/charts/alfresco-repository/README.md b/charts/alfresco-repository/README.md index c310ab9d6..2812cdb04 100644 --- a/charts/alfresco-repository/README.md +++ b/charts/alfresco-repository/README.md @@ -5,7 +5,7 @@ parent: Charts Reference # alfresco-repository -![Version: 0.7.2](https://img.shields.io/badge/Version-0.7.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 23.3.2](https://img.shields.io/badge/AppVersion-23.3.2-informational?style=flat-square) +![Version: 0.8.0-alpha.0](https://img.shields.io/badge/Version-0.8.0--alpha.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 23.3.2](https://img.shields.io/badge/AppVersion-23.3.2-informational?style=flat-square) Alfresco content repository Helm chart @@ -102,6 +102,11 @@ Checkout [alfresco-content-services chart's doc](https://github.com/Alfresco/acs | ingress.hosts[0].paths[1].path | string | `"/api-explorer"` | | | ingress.hosts[0].paths[1].pathType | string | `"Prefix"` | | | ingress.tls | list | `[]` | | +| initContainers.waitDbReady.image.pullPolicy | string | `"IfNotPresent"` | | +| initContainers.waitDbReady.image.repository | string | `"busybox"` | | +| initContainers.waitDbReady.image.tag | string | `"1.37.0"` | | +| initContainers.waitDbReady.resources.limits.cpu | string | `"250m"` | | +| initContainers.waitDbReady.resources.limits.memory | string | `"20Mi"` | | | livenessProbe.httpGet.path | string | `"/alfresco/api/-default-/public/alfresco/versions/1/probes/-live-"` | | | livenessProbe.httpGet.port | string | `"http"` | | | livenessProbe.periodSeconds | int | `20` | | diff --git a/charts/alfresco-repository/templates/deployment.yaml b/charts/alfresco-repository/templates/deployment.yaml index fdedc2db3..a4305fc9d 100644 --- a/charts/alfresco-repository/templates/deployment.yaml +++ b/charts/alfresco-repository/templates/deployment.yaml @@ -27,13 +27,11 @@ spec: {{- include "alfresco-common.imagePullSecrets" . | indent 6 }} initContainers: - name: wait-db-ready - image: busybox:1.35 - imagePullPolicy: IfNotPresent + image: {{ printf "%s:%s" .Values.initContainers.waitDbReady.image.repository .Values.initContainers.waitDbReady.image.tag | quote }} + imagePullPolicy: {{ .Values.initContainers.waitDbReady.image.pullPolicy }} {{- include "alfresco-common.component-security-context" dict | indent 8 }} resources: - limits: - cpu: "0.25" - memory: "20Mi" + {{- toYaml .Values.initContainers.waitDbReady.resources | nindent 12 }} env: {{ include "alfresco-repository.db.env" . | indent 12 }} command: diff --git a/charts/alfresco-repository/values.yaml b/charts/alfresco-repository/values.yaml index adf71cce4..d582ece5f 100644 --- a/charts/alfresco-repository/values.yaml +++ b/charts/alfresco-repository/values.yaml @@ -301,6 +301,16 @@ command: [] args: [] nodeSelector: {} tolerations: [] +initContainers: + waitDbReady: + image: + repository: busybox + tag: 1.37.0 + pullPolicy: IfNotPresent + resources: + limits: + cpu: 250m + memory: 20Mi global: # -- If a private image registry a secret can be defined and passed to # kubernetes, see: diff --git a/charts/alfresco-search-enterprise/Chart.yaml b/charts/alfresco-search-enterprise/Chart.yaml index bbf1524f7..47648f9c3 100644 --- a/charts/alfresco-search-enterprise/Chart.yaml +++ b/charts/alfresco-search-enterprise/Chart.yaml @@ -3,7 +3,7 @@ apiVersion: v2 name: alfresco-search-enterprise description: A Helm chart for deploying Alfresco Elasticsearch connector type: application -version: 4.2.0-alpha.2 +version: 4.2.0-alpha.3 appVersion: 4.1.0 dependencies: - name: alfresco-common diff --git a/charts/alfresco-search-enterprise/README.md b/charts/alfresco-search-enterprise/README.md index 5ca1fad7d..9bc0ca0e5 100644 --- a/charts/alfresco-search-enterprise/README.md +++ b/charts/alfresco-search-enterprise/README.md @@ -5,7 +5,7 @@ parent: Charts Reference # alfresco-search-enterprise -![Version: 4.2.0-alpha.2](https://img.shields.io/badge/Version-4.2.0--alpha.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.1.0](https://img.shields.io/badge/AppVersion-4.1.0-informational?style=flat-square) +![Version: 4.2.0-alpha.3](https://img.shields.io/badge/Version-4.2.0--alpha.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.1.0](https://img.shields.io/badge/AppVersion-4.1.0-informational?style=flat-square) A Helm chart for deploying Alfresco Elasticsearch connector @@ -109,7 +109,10 @@ Checkout [alfresco-content-services chart's doc](https://github.com/Alfresco/acs | reindexing.image.pullPolicy | string | `"IfNotPresent"` | | | reindexing.image.repository | string | `"quay.io/alfresco/alfresco-elasticsearch-reindexing"` | | | reindexing.image.tag | string | `"4.1.0"` | | -| reindexing.initcontainers.waitForRepository.resources.limits.cpu | string | `"0.25"` | | +| reindexing.initcontainers.waitForRepository.image.pullPolicy | string | `"IfNotPresent"` | | +| reindexing.initcontainers.waitForRepository.image.repository | string | `"curlimages/curl"` | | +| reindexing.initcontainers.waitForRepository.image.tag | string | `"8.11.0"` | | +| reindexing.initcontainers.waitForRepository.resources.limits.cpu | string | `"250m"` | | | reindexing.initcontainers.waitForRepository.resources.limits.memory | string | `"20Mi"` | | | reindexing.pathIndexingEnabled | bool | `true` | | | reindexing.repository.existingConfigMap.keys.url | string | `"REPOSITORY_URL"` | Key within the configmap holding the full url to connect to the alfresco repository | diff --git a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml index 0fde6b764..63bcdcd98 100644 --- a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml +++ b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml @@ -77,7 +77,8 @@ spec: protocol: TCP initContainers: - name: wait-for-repository - image: curlimages/curl:7.79.1 + image: {{ printf "%s:%s" .Values.reindexing.initcontainers.waitForRepository.image.repository .Values.reindexing.initcontainers.waitForRepository.image.tag | quote }} + imagePullPolicy: {{ .Values.reindexing.initcontainers.waitForRepository.image.pullPolicy }} {{- include "alfresco-common.component-security-context" .Values | indent 8 }} resources: {{- toYaml .Values.reindexing.initcontainers.waitForRepository.resources | nindent 12 }} env: diff --git a/charts/alfresco-search-enterprise/values.yaml b/charts/alfresco-search-enterprise/values.yaml index 8028b9f21..69953c349 100644 --- a/charts/alfresco-search-enterprise/values.yaml +++ b/charts/alfresco-search-enterprise/values.yaml @@ -272,10 +272,14 @@ reindexing: memory: "512Mi" initcontainers: waitForRepository: + image: + repository: curlimages/curl + tag: "8.11.0" + pullPolicy: IfNotPresent resources: limits: - cpu: "0.25" - memory: "20Mi" + cpu: 250m + memory: 20Mi serviceAccount: # Specifies whether a service account should be created create: true From 5953b7bcade5b7da5aefb461e5c1cb128a12443a Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Wed, 20 Nov 2024 14:45:09 +0100 Subject: [PATCH 2/3] add tests --- .../job-connector-hxi-bulk-ingester_test.yaml | 16 ++++++++++++++++ .../tests/deployment_test.yaml | 13 +++++++++++++ .../tests/reindexing-job_test.yaml | 12 ++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 charts/alfresco-connector-hxi/tests/job-connector-hxi-bulk-ingester_test.yaml diff --git a/charts/alfresco-connector-hxi/tests/job-connector-hxi-bulk-ingester_test.yaml b/charts/alfresco-connector-hxi/tests/job-connector-hxi-bulk-ingester_test.yaml new file mode 100644 index 000000000..6291b2d2f --- /dev/null +++ b/charts/alfresco-connector-hxi/tests/job-connector-hxi-bulk-ingester_test.yaml @@ -0,0 +1,16 @@ +--- +suite: test bulk ingester job manifest +templates: + - job-connector-hxi-bulk-ingester.yaml +tests: + - it: should have the default init container + asserts: + - equal: + path: spec.template.spec.initContainers[0].name + value: wait-for-repository + - matchRegex: + path: spec.template.spec.initContainers[0].image + pattern: "curlimages/curl:.+" + - equal: + path: spec.template.spec.initContainers[0].imagePullPolicy + value: IfNotPresent diff --git a/charts/alfresco-repository/tests/deployment_test.yaml b/charts/alfresco-repository/tests/deployment_test.yaml index 32f382f0f..8d978a3b2 100644 --- a/charts/alfresco-repository/tests/deployment_test.yaml +++ b/charts/alfresco-repository/tests/deployment_test.yaml @@ -226,6 +226,19 @@ tests: name: mycm key: DBDRIVER + - it: should have the default init container + values: *test_values + asserts: + - equal: + path: spec.template.spec.initContainers[0].name + value: wait-db-ready + - matchRegex: + path: spec.template.spec.initContainers[0].image + pattern: "busybox:.+" + - equal: + path: spec.template.spec.initContainers[0].imagePullPolicy + value: IfNotPresent + - it: should deploy with extra containers values: *test_values set: diff --git a/charts/alfresco-search-enterprise/tests/reindexing-job_test.yaml b/charts/alfresco-search-enterprise/tests/reindexing-job_test.yaml index 003972841..d9d075536 100644 --- a/charts/alfresco-search-enterprise/tests/reindexing-job_test.yaml +++ b/charts/alfresco-search-enterprise/tests/reindexing-job_test.yaml @@ -140,6 +140,18 @@ tests: - hasDocuments: count: 0 + - it: should render default init container + asserts: + - equal: + path: spec.template.spec.initContainers[0].name + value: wait-for-repository + - matchRegex: + path: spec.template.spec.initContainers[0].image + pattern: "curlimages/curl:.+" + - equal: + path: spec.template.spec.initContainers[0].imagePullPolicy + value: IfNotPresent + - it: render the initContainer with given configmap details set: reindexing: From 3ff4d4c0ef5b452d0df7de4b8e1b1b5edd55df6b Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Thu, 21 Nov 2024 10:44:48 +0100 Subject: [PATCH 3/3] refactor --- .../templates/job-connector-hxi-bulk-ingester.yaml | 8 +++++--- charts/alfresco-repository/templates/deployment.yaml | 11 ++++++----- .../templates/reindexing-job.yaml | 8 +++++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/charts/alfresco-connector-hxi/templates/job-connector-hxi-bulk-ingester.yaml b/charts/alfresco-connector-hxi/templates/job-connector-hxi-bulk-ingester.yaml index 9ede39a94..b149c3c2f 100644 --- a/charts/alfresco-connector-hxi/templates/job-connector-hxi-bulk-ingester.yaml +++ b/charts/alfresco-connector-hxi/templates/job-connector-hxi-bulk-ingester.yaml @@ -42,10 +42,12 @@ spec: protocol: TCP initContainers: - name: wait-for-repository - image: {{ printf "%s:%s" .Values.bulkIngester.initContainers.waitForRepository.image.repository .Values.bulkIngester.initContainers.waitForRepository.image.tag | quote }} - imagePullPolicy: {{ .Values.bulkIngester.initContainers.waitForRepository.image.pullPolicy }} + {{- with .Values.bulkIngester.initContainers.waitForRepository }} + image: {{ printf "%s:%s" .image.repository .image.tag | quote }} + imagePullPolicy: {{ .image.pullPolicy }} + resources: {{- toYaml .resources | nindent 12 }} + {{- end }} {{- include "alfresco-common.component-security-context" .Values | indent 8 }} - resources: {{- toYaml .Values.bulkIngester.initContainers.waitForRepository.resources | nindent 12 }} env: {{- $repoCtx := dict "Values" (dict "nameOverride" (printf "%s-%s" ($.Values.nameOverride | default $.Chart.Name) "repository")) "Chart" $.Chart "Release" $.Release }} {{- $repoCm := coalesce .Values.repository.existingConfigMap.name (include "alfresco-connector-hxi.fullname" $repoCtx) }} diff --git a/charts/alfresco-repository/templates/deployment.yaml b/charts/alfresco-repository/templates/deployment.yaml index a4305fc9d..47c788e43 100644 --- a/charts/alfresco-repository/templates/deployment.yaml +++ b/charts/alfresco-repository/templates/deployment.yaml @@ -27,11 +27,12 @@ spec: {{- include "alfresco-common.imagePullSecrets" . | indent 6 }} initContainers: - name: wait-db-ready - image: {{ printf "%s:%s" .Values.initContainers.waitDbReady.image.repository .Values.initContainers.waitDbReady.image.tag | quote }} - imagePullPolicy: {{ .Values.initContainers.waitDbReady.image.pullPolicy }} - {{- include "alfresco-common.component-security-context" dict | indent 8 }} - resources: - {{- toYaml .Values.initContainers.waitDbReady.resources | nindent 12 }} + {{- with .Values.initContainers.waitDbReady }} + image: {{ printf "%s:%s" .image.repository .image.tag | quote }} + imagePullPolicy: {{ .image.pullPolicy }} + resources: {{- toYaml .resources | nindent 12 }} + {{- end }} + {{- include "alfresco-common.component-security-context" .Values | indent 8 }} env: {{ include "alfresco-repository.db.env" . | indent 12 }} command: diff --git a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml index 63bcdcd98..1e3ca0bf0 100644 --- a/charts/alfresco-search-enterprise/templates/reindexing-job.yaml +++ b/charts/alfresco-search-enterprise/templates/reindexing-job.yaml @@ -77,10 +77,12 @@ spec: protocol: TCP initContainers: - name: wait-for-repository - image: {{ printf "%s:%s" .Values.reindexing.initcontainers.waitForRepository.image.repository .Values.reindexing.initcontainers.waitForRepository.image.tag | quote }} - imagePullPolicy: {{ .Values.reindexing.initcontainers.waitForRepository.image.pullPolicy }} + {{- with .Values.reindexing.initcontainers.waitForRepository }} + image: {{ printf "%s:%s" .image.repository .image.tag | quote }} + imagePullPolicy: {{ .image.pullPolicy }} + resources: {{- toYaml .resources | nindent 12 }} + {{- end }} {{- include "alfresco-common.component-security-context" .Values | indent 8 }} - resources: {{- toYaml .Values.reindexing.initcontainers.waitForRepository.resources | nindent 12 }} env: {{- $repoCtx := dict "Values" (dict "nameOverride" (printf "%s-%s" ($.Values.nameOverride | default $.Chart.Name) "repository")) "Chart" $.Chart "Release" $.Release }} {{- $repoCm := coalesce .Values.reindexing.repository.existingConfigMap.name (include "alfresco-search-enterprise.fullname" $repoCtx) }}