From 9a940ceae428ba56e59a84babc8366bf4dbe4105 Mon Sep 17 00:00:00 2001 From: Martin Gruner Date: Wed, 8 May 2024 13:37:32 +0200 Subject: [PATCH] Add possibility to specify custom volumes and volumeMounts for Zammad Pods (#272) --- zammad/Chart.yaml | 4 ++-- zammad/ci/default-values.yaml | 9 +++++++++ zammad/ci/full-objects.yaml | 19 +++++++++++++++++++ zammad/ci/full-values.yaml | 8 ++++++++ zammad/templates/_helpers.tpl | 6 ++++++ zammad/templates/tests/run-tests.yaml | 23 +++++++++++++++++++++++ zammad/values.yaml | 14 +++++++++++++- 7 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 zammad/templates/tests/run-tests.yaml diff --git a/zammad/Chart.yaml b/zammad/Chart.yaml index 6a70307c..b9b20d8c 100644 --- a/zammad/Chart.yaml +++ b/zammad/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: zammad -version: 12.0.3 -appVersion: 6.3.0-17 +version: 12.1.0 +appVersion: 6.3.0-20 description: Zammad is a web based open source helpdesk/customer support system with many features to manage customer communication via several channels like telephone, facebook, twitter, chat and e-mails. home: https://zammad.org icon: https://raw.githubusercontent.com/zammad/zammad-documentation/main/images/zammad_logo_600x520.png diff --git a/zammad/ci/default-values.yaml b/zammad/ci/default-values.yaml index e69de29b..b87a2449 100644 --- a/zammad/ci/default-values.yaml +++ b/zammad/ci/default-values.yaml @@ -0,0 +1,9 @@ +zammadConfig: + customVolumes: + - name: custom-volume + configMap: + name: helm-tests + customVolumeMounts: + - name: custom-volume + mountPath: /opt/zammad/lib/tasks/helm + readOnly: true diff --git a/zammad/ci/full-objects.yaml b/zammad/ci/full-objects.yaml index c4cdd2ce..16c11824 100644 --- a/zammad/ci/full-objects.yaml +++ b/zammad/ci/full-objects.yaml @@ -55,3 +55,22 @@ spec: resources: requests: storage: 32Mi +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: helm-tests + namespace: zammad +data: + helm-test.rake: |- + namespace :zammad do + namespace :helm do + desc 'Runs a set of Helm tests' + task test: :environment do |_task, args| + puts 'Checking if temporary file can be created...' + Tempfile.create do |f| + puts ' Temporary file was created successfully.' + end + end + end + end \ No newline at end of file diff --git a/zammad/ci/full-values.yaml b/zammad/ci/full-values.yaml index cd174994..3789ce94 100644 --- a/zammad/ci/full-values.yaml +++ b/zammad/ci/full-values.yaml @@ -41,3 +41,11 @@ zammadConfig: existingClaim: 'storage-volume-claim' minio: enabled: true + customVolumes: + - name: custom-volume + configMap: + name: helm-tests + customVolumeMounts: + - name: custom-volume + mountPath: /opt/zammad/lib/tasks/helm + readOnly: true diff --git a/zammad/templates/_helpers.tpl b/zammad/templates/_helpers.tpl index 48bbe19c..4e88f62d 100644 --- a/zammad/templates/_helpers.tpl +++ b/zammad/templates/_helpers.tpl @@ -197,6 +197,9 @@ volume mounts for the Zammad Rails stack - name: autowizard mountPath: "/opt/zammad/tmp/auto_wizard" {{- end }} +{{- with .Values.zammadConfig.customVolumeMounts }} +{{ toYaml . }} +{{- end -}} {{- end -}} {{/* @@ -222,6 +225,9 @@ volumes for the Zammad Rails stack - key: {{ .Values.secrets.autowizard.secretKey }} path: auto_wizard.json {{- end }} +{{- with .Values.zammadConfig.customVolumes }} +{{ toYaml . }} +{{- end -}} {{- end -}} {{/* diff --git a/zammad/templates/tests/run-tests.yaml b/zammad/templates/tests/run-tests.yaml new file mode 100644 index 00000000..8837c5bd --- /dev/null +++ b/zammad/templates/tests/run-tests.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "zammad.fullname" . }}-run-tests" + labels: + {{- include "zammad.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + {{- include "zammad.podSpec.deployment" . | nindent 4 }} + containers: + - name: zammad-run-tests + {{- include "zammad.containerSpec" (merge (dict "containerConfig" dict) .) | nindent 8 }} + command: ['bundle'] + args: ['exec', 'rake', 'zammad:helm:test'] + env: + {{- include "zammad.env" . | nindent 12 }} + {{- include "zammad.env.failOnPendingMigrations" . | nindent 12 }} + volumeMounts: + {{- include "zammad.volumeMounts" . | nindent 10 }} + volumes: + {{- include "zammad.volumes" . | nindent 6 }} + restartPolicy: Never diff --git a/zammad/values.yaml b/zammad/values.yaml index 3692a900..d74c0155 100644 --- a/zammad/values.yaml +++ b/zammad/values.yaml @@ -232,6 +232,18 @@ zammadConfig: # see: https://github.com/kubernetes/kubernetes/issues/76158 & https://github.com/kubernetes/kubernetes/issues/110835 # medium: Memory + # Custom volumes for all Zammad Pods. + customVolumes: + # - name: custom-volume + # configMap: + # name: my-config-map + + # Custom volumeMounts for all Zammad Pods. + customVolumeMounts: + # - name: custom-volume + # mountPath: "/opt/zammad/config_map" + # readOnly: true + websocket: livenessProbe: tcpSocket: @@ -365,7 +377,7 @@ autoWizard: # "lastname": "Admin", # "email": "email@example.org", # "organization": "ZammadTest", - # "password": "YourPassword" + # "password": "..." # } # ], # "Settings": [