Skip to content

Commit

Permalink
feat: bump mailu version to 2.0.22 (#296)
Browse files Browse the repository at this point in the history
Signed-off-by: fastlorenzo <[email protected]>
  • Loading branch information
fastlorenzo authored Aug 29, 2023
1 parent 96c568f commit 17d3b94
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mailu/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 2.0.20
appVersion: 2.0.22
version: 1.3.0
name: mailu
description: This chart installs the Mailu mail system on kubernetes
Expand Down
20 changes: 19 additions & 1 deletion mailu/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,25 @@ Get MailU domain name or throw an error if not set
{{- end -}}

{{/*
Helper function to get the correct admin port.
Change was made in Mailu 2.0.22 and the port was switched from 80 to 8080.
This is for retro-compatibility purposes.
We need to perform some error handling in case the version provided is not a valid semver.
Only "master" is allowed to be used as a version other than the semver notation.
*/}}
{{- define "mailu.admin.port" -}}
{{- $semverRegex := `^v?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-zA-Z-]+(?:\.[\da-zA-Z-]+)*)?(?:\+[\da-zA-Z-]+(?:\.[\da-zA-Z-]+)*)?$` -}}
{{- $version := (default (include "mailu.version" .) .Values.admin.image.tag) -}}
{{- if mustRegexMatch $semverRegex $version -}}
{{- if semverCompare "<2.0.22" $version -}}
{{- print "80" -}}
{{- else -}}
{{- print "8080" -}}
{{- end -}}
{{- else -}}
{{- print "8080" -}}
{{- end -}}
{{- end -}}

{{/* Check for deprecated values and raise an error if found (upgrade to v1.0.0) */}}
{{- define "mailu.validateValues.deprecated" -}}
Expand Down
2 changes: 1 addition & 1 deletion mailu/templates/admin/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ spec:
{{- end }}
ports:
- name: http
containerPort: 80
containerPort: {{ int (include "mailu.admin.port" .) }}
protocol: TCP
{{- if .Values.admin.resources }}
resources: {{- toYaml .Values.admin.resources | nindent 12 }}
Expand Down
6 changes: 3 additions & 3 deletions mailu/templates/admin/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ spec:
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: admin
ports:
- name: http
port: 80
protocol: TCP
- name: http
port: {{ int (include "mailu.admin.port" .) }}
protocol: TCP

0 comments on commit 17d3b94

Please sign in to comment.