Skip to content

Commit 619bf4d

Browse files
authored
Changes for Zammad 7.0 (#395)
- Update to Zammad 7.0 - Adds support for Redis Sentinel. Fixes #391. - Fix all `rails` invocations to use `bundle exec rails`. - Pass POSTGRESQL_* variables directly rather than DATABASE_URL - Zammad 7.0 is able to construct the DATABASE_URL itself, so it's better to pass the raw variables to it to avoid issues with special character escaping. - The bitnami memcached subchart was replaced with [cloudpirates-memcached/memcached](https://artifacthub.io/packages/helm/cloudpirates-memcached/memcached). This should be a seamless update. Closes #402 - The bitnami redis subchart was replaced with [cloudpirates-redis/redis](https://artifacthub.io/packages/helm/cloudpirates-redis/redis). Please check your values for this subchart, as there have been minor changes here (resources configuration is now on the top level rather than in `master`). The name of the primary redis service has changed from `{{ .Release.Name }}-redis-master` to `{{ .Release.Name }}-redis`. A data migration is not required here. Fixes #367, closes: #401
1 parent cabd67e commit 619bf4d

File tree

8 files changed

+169
-98
lines changed

8 files changed

+169
-98
lines changed

.github/updatecli.yaml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ sources:
66
spec:
77
image: "zammad/zammad-docker-compose"
88
architecture: "linux/amd64"
9-
# tagfilter: "^6\\.5\\.2$"
10-
# tagfilter: "^6\\.5\\.2-\\d{1}"
11-
tagfilter: "^6\\.5\\.2-\\d{2}"
12-
# tagfilter: "^6\\.5\\.2-\\d{3}"
9+
tagfilter: "^7\\.0\\.0$"
10+
# tagfilter: "^7\\.0\\.0-\\d{1}"
11+
# tagfilter: "^7\\.0\\.0-\\d{2}"
12+
# tagfilter: "^7\\.0\\.0-\\d{3}"
1313
alpine:
1414
kind: dockerimage
1515
spec:
@@ -32,27 +32,27 @@ sources:
3232
# name: minio
3333
# versionfilter:
3434
# pattern: "14.x.x"
35-
# memcached:
36-
# kind: helmchart
37-
# spec:
38-
# url: https://charts.bitnami.com/bitnami
39-
# name: memcached
40-
# versionfilter:
41-
# pattern: "7.x.x"
35+
memcached:
36+
kind: helmchart
37+
spec:
38+
url: oci://ghcr.io/cloudpirates-io/helm-charts
39+
name: memcached
40+
versionfilter:
41+
pattern: "0.x.x"
4242
# postgresql:
4343
# kind: helmchart
4444
# spec:
4545
# url: https://charts.bitnami.com/bitnami
4646
# name: postgresql
4747
# versionfilter:
4848
# pattern: "16.x.x"
49-
# redis:
50-
# kind: helmchart
51-
# spec:
52-
# url: https://charts.bitnami.com/bitnami
53-
# name: redis
54-
# versionfilter:
55-
# pattern: "20.x.x"
49+
redis:
50+
kind: helmchart
51+
spec:
52+
url: oci://ghcr.io/cloudpirates-io/helm-charts
53+
name: redis
54+
versionfilter:
55+
pattern: "0.x.x"
5656

5757
conditions: {}
5858

@@ -88,14 +88,14 @@ targets:
8888
# file: "Chart.yaml"
8989
# key: "$.dependencies[1].version"
9090
# versionincrement: patch
91-
# memcached:
92-
# kind: helmchart
93-
# sourceid: memcached
94-
# spec:
95-
# name: "zammad"
96-
# file: "Chart.yaml"
97-
# key: "$.dependencies[2].version"
98-
# versionincrement: patch
91+
memcached:
92+
kind: helmchart
93+
sourceid: memcached
94+
spec:
95+
name: "zammad"
96+
file: "Chart.yaml"
97+
key: "$.dependencies[2].version"
98+
versionincrement: patch
9999
# postgresql:
100100
# kind: helmchart
101101
# sourceid: postgresql
@@ -104,11 +104,11 @@ targets:
104104
# file: "Chart.yaml"
105105
# key: "$.dependencies[3].version"
106106
# versionincrement: patch
107-
# redis:
108-
# kind: helmchart
109-
# sourceid: redis
110-
# spec:
111-
# name: "zammad"
112-
# file: "Chart.yaml"
113-
# key: "$.dependencies[4].version"
114-
# versionincrement: patch
107+
redis:
108+
kind: helmchart
109+
sourceid: redis
110+
spec:
111+
name: "zammad"
112+
file: "Chart.yaml"
113+
key: "$.dependencies[4].version"
114+
versionincrement: patch

.github/workflows/ci.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ permissions: read-all
44

55
on:
66
pull_request:
7-
branches:
8-
- main
97

108
env:
119
helm-version: "v3.19.4"

zammad/Chart.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
name: zammad
3-
version: 15.7.0
4-
appVersion: 6.5.2-85
3+
version: 16.0.0
4+
appVersion: 7.0.0
55
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.
66
home: https://zammad.org
77
icon: https://raw.githubusercontent.com/zammad/zammad-documentation/main/images/zammad_logo_600x520.png
@@ -23,14 +23,14 @@ dependencies:
2323
repository: https://charts.bitnami.com/bitnami
2424
condition: zammadConfig.minio.enabled
2525
- name: memcached
26-
version: 7.9.3
27-
repository: https://charts.bitnami.com/bitnami
26+
version: 0.10.1
27+
repository: oci://ghcr.io/cloudpirates-io/helm-charts
2828
condition: zammadConfig.memcached.enabled
2929
- name: postgresql
3030
version: 16.7.21
3131
repository: https://charts.bitnami.com/bitnami
3232
condition: zammadConfig.postgresql.enabled
3333
- name: redis
34-
version: 20.13.4
35-
repository: https://charts.bitnami.com/bitnami
34+
version: 0.25.6
35+
repository: oci://ghcr.io/cloudpirates-io/helm-charts
3636
condition: zammadConfig.redis.enabled

zammad/README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ Note that this `PVC` must provide `ReadWriteMany` access to work properly for th
9393
#### How to migrate from `File` to `S3` storage
9494

9595
- In the admin panel, go to "System -> Storage" and select "Simple Storage (S3)" as the new storage provider.
96-
- Migrate existing `File` store content by running `kubectl exec zammad-0 -c zammad-railsserver -- rails r "Store::File.move('File', 'S3')"`. Example:
96+
- Migrate existing `File` store content by running `kubectl exec zammad-0 -c zammad-railsserver -- bundle exec rails r "Store::File.move('File', 'S3')"`. Example:
9797

9898
```log
99-
kubectl exec zammad-0 -c zammad-railsserver -- rails r "Store::File.move('File', 'S3')"
99+
kubectl exec zammad-0 -c zammad-railsserver -- bundle exec rails r "Store::File.move('File', 'S3')"
100100
I, [2024-01-24T11:06:13.501572 #168] INFO -- : ActionCable is using the redis instance at redis://:zammad@zammad-redis-master:6379.
101101
I, [2024-01-24T11:06:13.506180#168-5980] INFO -- : Using memcached as Rails cache store.
102102
I, [2024-01-24T11:06:13.506246#168-5980] INFO -- : Using the Redis back end for Zammad's web socket session store.
@@ -193,15 +193,24 @@ available. You can create a job from a cronjob template for it:
193193
kubectl create job my-reindex-job --from=cronjob/zammad-cronjob-reindex
194194
```
195195

196-
This cronjob never runs by default, but you can channge `zammadConfig.cronJob.reindex.suspend`
196+
This cronjob never runs by default, but you can change `zammadConfig.cronJob.reindex.suspend`
197197
and `zammadConfig.cronJob.reindex.schedule` if you want to run it periodically.
198198

199199
## Upgrading
200200

201+
### From Chart Version 15.x to 16.0.0
202+
203+
- The bitnami memcached subchart was replaced with [cloudpirates-memcached/memcached](https://artifacthub.io/packages/helm/cloudpirates-memcached/memcached).
204+
This should be a seamless update.
205+
- The bitnami redis subchart was replaced with [cloudpirates-redis/redis](https://artifacthub.io/packages/helm/cloudpirates-redis/redis).
206+
- Please check your values for this subchart, as there have been minor changes here (resources configuration is now on the top level rather than in `master`).
207+
- The name of the primary redis service has changed from `{{ .Release.Name }}-redis-master` to `{{ .Release.Name }}-redis`.
208+
- The new subchart creates its own `PersistentVolumeClaim`. As Zammad does not store permantent data in Redis, there is no data migration required here. Feel free to clean up the unused `PersistentVolumeClaim` from the previous subchart at your convenience (it has `master` in its name, e.g. `redis-data-zammad-redis-master-0`).
209+
201210
### From Chart Version 14.x to 15.0.0
202211

203-
- The selector matchLabels of all deployments changed which are unfortunately immutable. This means each deployment needs to
204-
be deleted before upgrading the helm chart. To preserve high availability the `cascade=orphan` option can be used
212+
- The selector matchLabels of all deployments changed which are unfortunately immutable. This means each deployment needs to
213+
be deleted before upgrading the helm chart. To preserve high availability the `cascade=orphan` option can be used
205214
(e.g. `kubectl/oc delete deployment --selector app.kubernetes.io/name=zammad --cascade=orphan`).
206215

207216
### From Chart Version 13.x to 14.0.0

zammad/ci/full-values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ secrets:
1515
useExisting: true
1616
secretKey: redis-password
1717
secretName: redis-existing-secret
18+
sentinel:
19+
useExisting: true
20+
secretKey: redis-password
21+
secretName: redis-existing-secret
1822

1923
autoWizard:
2024
enabled: true
@@ -30,10 +34,14 @@ minio:
3034
auth:
3135
existingSecret: minio-existing-secret
3236

37+
# Use existing Redis secrets and run in Redis Sentinel mode.
3338
redis:
3439
auth:
3540
existingSecret: redis-existing-secret
3641
existingSecretPasswordKey: redis-password
42+
sentinel:
43+
enabled: true
44+
architecture: replication
3745

3846
zammadConfig:
3947
storageVolume:
@@ -60,6 +68,9 @@ zammadConfig:
6068
my-railsserver-pod-label: my-railsserver-pod-label-value
6169
podAnnotations:
6270
my-railsserver-pod-annotation: my-railsserver-pod-annotation-value
71+
redis:
72+
sentinel:
73+
enabled: true
6374
scheduler:
6475
podLabels:
6576
my-scheduler-pod-label: my-scheduler-pod-label-value

zammad/templates/_helpers.tpl

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,17 @@ redis secret name
138138
{{- end -}}
139139
{{- end -}}
140140

141+
{{/*
142+
redis sentinel secret name
143+
*/}}
144+
{{- define "zammad.redisSentinelSecretName" -}}
145+
{{- if .Values.secrets.redis.sentinel.useExisting -}}
146+
{{ .Values.secrets.redis.sentinel.secretName }}
147+
{{- else -}}
148+
{{ include "zammad.fullname" . }}-{{ .Values.secrets.redis.sentinel.secretName }}
149+
{{- end -}}
150+
{{- end -}}
151+
141152
{{/*
142153
S3 access URL
143154
*/}}
@@ -176,29 +187,72 @@ S3 access URL
176187
{{- end -}}
177188

178189
{{/*
179-
environment variables for the Zammad Rails stack
190+
Redis Variables
180191
*/}}
181-
{{- define "zammad.env" -}}
182-
{{- if or .Values.zammadConfig.redis.pass .Values.secrets.redis.useExisting -}}
192+
{{- define "zammad.env.redisVariables" -}}
193+
{{- if .Values.zammadConfig.redis.sentinel.username }}
194+
- name: REDIS_USERNAME
195+
value: "{{ .Values.zammadConfig.redis.username }}"
196+
{{- end }}
197+
{{- if or .Values.zammadConfig.redis.pass .Values.secrets.redis.useExisting }}
183198
- name: REDIS_PASSWORD
184199
valueFrom:
185200
secretKeyRef:
186201
name: {{ include "zammad.redisSecretName" . }}
187202
key: {{ .Values.secrets.redis.secretKey }}
188203
{{- end }}
204+
# sentinel
205+
{{- if .Values.zammadConfig.redis.sentinel.enabled }}
206+
- name: REDIS_SENTINELS
207+
{{- if .Values.zammadConfig.redis.enabled }}
208+
value: "{{ .Release.Name }}-redis"
209+
{{- else }}
210+
value: "{{ join "," .Values.zammadConfig.redis.sentinel.sentinels }}"
211+
{{- end }}
212+
- name: REDIS_SENTINEL_NAME
213+
value: "{{ .Values.zammadConfig.redis.sentinel.masterName | default "mymaster" }}"
214+
{{- if .Values.zammadConfig.redis.sentinel.username }}
215+
- name: REDIS_SENTINEL_USERNAME
216+
value: "{{ .Values.zammadConfig.redis.sentinel.username }}"
217+
{{- end }}
218+
{{- if or .Values.zammadConfig.redis.sentinel.pass .Values.secrets.redis.useExisting }}
219+
- name: REDIS_SENTINEL_PASSWORD
220+
valueFrom:
221+
secretKeyRef:
222+
name: {{ include "zammad.redisSentinelSecretName" . }}
223+
key: {{ .Values.secrets.redis.sentinel.secretKey }}
224+
{{- end }}
225+
{{- else }}
226+
# standalone
227+
- name: REDIS_URL
228+
value: "redis://{{ .Values.zammadConfig.redis.username }}:$(REDIS_PASSWORD)@{{ if .Values.zammadConfig.redis.enabled }}{{ .Release.Name }}-redis{{ else }}{{ .Values.zammadConfig.redis.host }}{{ end }}:{{ .Values.zammadConfig.redis.port }}"
229+
{{- end }}
230+
{{- end }}
231+
232+
{{/*
233+
environment variables for the Zammad Rails stack
234+
*/}}
235+
{{- define "zammad.env" -}}
236+
{{ include "zammad.env.redisVariables" . }}
189237
- name: MEMCACHE_SERVERS
190238
value: "{{ if .Values.zammadConfig.memcached.enabled }}{{ .Release.Name }}-memcached{{ else }}{{ .Values.zammadConfig.memcached.host }}{{ end }}:{{ .Values.zammadConfig.memcached.port }}"
191239
- name: RAILS_TRUSTED_PROXIES
192240
value: "{{ .Values.zammadConfig.railsserver.trustedProxies }}"
193-
- name: REDIS_URL
194-
value: "redis://:$(REDIS_PASSWORD)@{{ if .Values.zammadConfig.redis.enabled }}{{ .Release.Name }}-redis-master{{ else }}{{ .Values.zammadConfig.redis.host }}{{ end }}:{{ .Values.zammadConfig.redis.port }}"
241+
- name: POSTGRESQL_HOST
242+
value: {{ if .Values.zammadConfig.postgresql.enabled }}{{ .Release.Name }}-postgresql{{ else }}{{ .Values.zammadConfig.postgresql.host }}{{ end }}
243+
- name: POSTGRESQL_PORT
244+
value: {{ .Values.zammadConfig.postgresql.port | toString | toYaml }}
245+
- name: POSTGRESQL_USER
246+
value: {{ .Values.zammadConfig.postgresql.user }}
195247
- name: POSTGRESQL_PASS
196248
valueFrom:
197249
secretKeyRef:
198250
name: {{ include "zammad.postgresqlSecretName" . }}
199251
key: {{ .Values.secrets.postgresql.secretKey }}
200-
- name: DATABASE_URL
201-
value: "postgres://{{ .Values.zammadConfig.postgresql.user }}:$(POSTGRESQL_PASS)@{{ if .Values.zammadConfig.postgresql.enabled }}{{ .Release.Name }}-postgresql{{ else }}{{ .Values.zammadConfig.postgresql.host }}{{ end }}:{{ .Values.zammadConfig.postgresql.port }}/{{ .Values.zammadConfig.postgresql.db }}?{{ .Values.zammadConfig.postgresql.options }}"
252+
- name: POSTGRESQL_DB
253+
value: {{ .Values.zammadConfig.postgresql.db }}
254+
- name: POSTGRESQL_OPTIONS
255+
value: {{ .Values.zammadConfig.postgresql.options }}
202256
{{ include "zammad.env.S3_URL" . }}
203257
- name: TMP # All zammad containers need the possibility to create temporary files, e.g. for file uploads or image resizing.
204258
value: {{ .Values.zammadConfig.railsserver.tmpdir }}

zammad/templates/secrets.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,20 @@ type: Opaque
5454
data:
5555
{{ .Values.secrets.redis.secretKey }}: {{ .Values.zammadConfig.redis.pass | b64enc | quote }}
5656
{{ end }}
57+
58+
{{ if and .Values.zammadConfig.redis.sentinel.enabled }}
59+
{{ if and .Values.zammadConfig.redis.sentinel.pass (not .Values.secrets.redis.sentinel.useExisting) }}
60+
---
61+
apiVersion: v1
62+
kind: Secret
63+
metadata:
64+
name: {{ include "zammad.redisSentinelSecretName" . }}
65+
labels:
66+
{{- include "zammad.labels" . | nindent 4 }}
67+
annotations:
68+
{{- include "zammad.annotations" . | nindent 4 }}
69+
type: Opaque
70+
data:
71+
{{ .Values.secrets.redis.sentinel.secretKey }}: {{ .Values.zammadConfig.redis.sentinel.pass | b64enc | quote }}
72+
{{ end }}
73+
{{ end }}

0 commit comments

Comments
 (0)