Verified Commit 320a8ba6 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Add kustomize deployment configs for service

parent c0b17006
Loading
Loading
Loading
Loading

certificate.yaml

0 → 100644
+13 −0
Original line number Diff line number Diff line
apiVersion: cert-manager.io/v1
kind: Certificate

metadata:
  name: smtp.kodo.org.uk
spec:
  commonName: smtp.kodo.org.uk
  dnsNames:
  - smtp.kodo.org.uk
  issuerRef:
    kind: ClusterIssuer
    name: letsencrypt
  secretName: smtp.kodo.org.uk

deployment.patch.yaml

0 → 100644
+52 −0
Original line number Diff line number Diff line
apiVersion: apps/v1
kind: Deployment
metadata:
  name: postfix
  annotations:
    reloader.stakater.com/auto: "true"

spec:
  template:
    spec:
      volumes:
      - name: config
        emptyDir: {}
      - name: base-config
        configMap:
          name: postfix
      - name: tls
        secret:
          secretName: smtp.kodo.org.uk
      - name: mysql
        secret:
          secretName: maildb.kodo.org.uk

      containers:
      - name: postfix
        volumeMounts:
        - name: config
          mountPath: /etc/postfix
        - name: tls
          mountPath: /etc/tls

      initContainers:
      - name: init-mysql
        image: busybox:latest
        volumeMounts:
        - name: config
          mountPath: /etc/postfix
        - name: base-config
          mountPath: /source
        - name: mysql
          mountPath: /secrets
        command:
        - sh
        - -c
        - |
          . /secrets/pass.cnf
          cp -Lr /source/* /etc/postfix/
          tee -a /etc/postfix/mysql_*.cf <<END_CONF >/dev/null
          hosts = dex.kodo.org.uk
          user = $username
          password = $password
          END_CONF

kustomization.yaml

0 → 100644
+17 −0
Original line number Diff line number Diff line
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- https://code.kodo.org.uk/docker/postfix//kustomize/?ref=main
- certificate.yaml

patches:
- path: deployment.patch.yaml

configMapGenerator:
- name: postfix
  files:
  - conf/bounce.cf
  - conf/main.cf
  - conf/mysql_alias.cf
  - conf/mysql_domains.cf