Skip to content

Commit

Permalink
Allow customizing init job (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
timoschwarzer committed May 22, 2024
1 parent 9fe0460 commit 11b6d0d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
4 changes: 2 additions & 2 deletions zammad/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: zammad
version: 12.1.1
appVersion: 6.3.1
version: 12.2.0
appVersion: 6.3.1-4
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
Expand Down
13 changes: 13 additions & 0 deletions zammad/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,19 @@ redis:
enabled: false
```

### Deploying with ArgoCD

Due to the way Argo CD syncs Helm charts into the cluster and this chart deploying the initialization job, the default configuration can lead to Sync loops where Argo CD will create an infinite amount of initialization jobs.
To prevent this, disable the random name for the initialization job and add the according annotation to the job to let Argo CD treat it as a Sync Hook.

```yaml
zammadConfig:
initJob:
randomName: false
annotations:
argocd.argoproj.io/hook: Sync
```

## Upgrading

### From Chart Version 11.x to 12.0.0
Expand Down
12 changes: 10 additions & 2 deletions zammad/templates/job-init.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "zammad.fullname" . }}-init-{{ uuidv4 }}
{{- if .Values.zammadConfig.initJob.randomName }}
# Use a different job name on each run to ensure a new job always runs once.
name: {{ include "zammad.fullname" . }}-init-{{ uuidv4 }}
{{- else }}
name: {{ include "zammad.fullname" . }}-init
{{- end}}
# Helm post-install/post-upgrade hooks cannot be used here, because
# helm's --wait flag causes a deadlock: the job waits for all resources to be ready,
# but the pods need the job to work properly.
labels:
{{- include "zammad.labels" . | nindent 4 }}
{{- with .Values.zammadConfig.initJob.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ttlSecondsAfterFinished: 300
template:
Expand Down Expand Up @@ -90,4 +98,4 @@ spec:
- name: {{ include "zammad.fullname" . }}-init
configMap:
name: {{ include "zammad.fullname" . }}-init
defaultMode: 0755
defaultMode: 0755
5 changes: 5 additions & 0 deletions zammad/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,11 @@ zammadConfig:
customInit: ""
# bundle exec rails runner '…'

initJob:
randomName: true
annotations: {}
# my-annotation: "value"

# additional environment vars added to all zammad services
extraEnv: []
# - name: FOO_BAR
Expand Down

0 comments on commit 11b6d0d

Please sign in to comment.