30 lines
1 KiB
Text
30 lines
1 KiB
Text
|
|
{% if taskserv.panel_enabled == "mail" %}
|
||
|
|
apiVersion: v1
|
||
|
|
kind: ConfigMap
|
||
|
|
metadata:
|
||
|
|
name: {{ taskserv.name }}-setup-proxy
|
||
|
|
namespace: {{ taskserv.namespace }}
|
||
|
|
labels:
|
||
|
|
app.kubernetes.io/name: {{ taskserv.name }}
|
||
|
|
app.kubernetes.io/managed-by: provisioning
|
||
|
|
data:
|
||
|
|
dms-setup-proxy.sh: |
|
||
|
|
#!/bin/sh
|
||
|
|
# Proxies setup.sh calls via kubectl exec into the docker-mailserver container.
|
||
|
|
# The panel is a standalone addon on the same node — write ops need the
|
||
|
|
# postfix/dovecot binaries that only exist inside the mail container.
|
||
|
|
set -e
|
||
|
|
pod=$(kubectl get pod \
|
||
|
|
-n {{ taskserv.mail_namespace }} \
|
||
|
|
-l {{ taskserv.mail_pod_selector }} \
|
||
|
|
-o name \
|
||
|
|
--field-selector=status.phase=Running \
|
||
|
|
| head -1)
|
||
|
|
if [ -z "$pod" ]; then
|
||
|
|
echo "error: no running pod in {{ taskserv.mail_namespace }} matching {{ taskserv.mail_pod_selector }}" >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
exec kubectl exec -n {{ taskserv.mail_namespace }} "$pod" \
|
||
|
|
-c {{ taskserv.mail_container }} -- /usr/local/bin/setup.sh "$@"
|
||
|
|
{% endif %}
|