Skip to content

Commit

Permalink
nuke, try doing it better
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathon2nd committed Dec 29, 2023
1 parent 1c71da7 commit baa824b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
20 changes: 20 additions & 0 deletions helm/mail/templates/hostname-script.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.GenerateHostName.enabled }}
{{- $chart := "mail" -}}
{{- $fullName := include (print $chart ".fullname") . -}}
{{- $labels := include (print $chart ".labels") . -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: hostname-init
labels:
{{- $labels | nindent 4 }}
data:
set_hostname.sh: |
#!/usr/bin/env bash
# This should be placed under /docker-init.db/set_hostname.sh
IP=$(curl http://ipinfo.io/ip)
IP=$(echo "$IP" | tr '.' '-')
PREFIX={{- .Values.GenerateHostName.prefix -}};
DOMAIN={{- .Values.GenerateHostName.domain -}};
postconf -e "myhostname=${PREFIX}-${IP}.${DOMAIN}"
{{- end }}
10 changes: 10 additions & 0 deletions helm/mail/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ spec:
readOnly: true
{{- end }}
{{- if .Values.extraVolumeMounts }}{{- toYaml .Values.extraVolumeMounts | nindent 12 }}{{ end }}
{{- if .Values.GenerateHostName.enabled }}
- mountPath: "/docker-init.db/"
name: hostname-init
{{- end }}
resources: {{ toYaml .Values.resources | nindent 12 }}
{{- if .Values.metrics.enabled }}
- name: exporter
Expand Down Expand Up @@ -218,6 +222,12 @@ spec:
name: {{ print $fullName "-scripts" | quote }}
defaultMode: 0777
{{- end }}
{{- if .Values.GenerateHostName.enabled }}
- name: hostname-init
configMap:
name: hostname-init
defaultMode: 0777
{{- end }}
{{- if .Values.extraVolumes }}{{- toYaml .Values.extraVolumes | nindent 8 }}{{ end }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
volumeClaimTemplates:
Expand Down
6 changes: 6 additions & 0 deletions helm/mail/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ mountSecret:
# < redacted >
# -----END RSA PRIVATE KEY-----

# if the following is true, config.prefix.myhostname should not be set
GenerateHostName:
enabled: false
domain: example.com
prefix: smtp

config:
general: {}
# e.g.
Expand Down

0 comments on commit baa824b

Please sign in to comment.