Verified Commit b99a8683 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Add Kustomize deployment configs

parent db1521ce
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: imap.kodo.org.uk
spec:
  secretName: imap.kodo.org.uk
  commonName: imap.kodo.org.uk
  dnsNames:
  - imap.kodo.org.uk
  issuerRef:
    kind: ClusterIssuer
    name: letsencrypt

deployment.patch.yaml

0 → 100644
+82 −0
Original line number Diff line number Diff line
apiVersion: apps/v1
kind: Deployment

metadata:
  name: dovecot
  labels: &labels
    app.kubernetes.io/instance: legacy

spec:
  selector:
    matchLabels: *labels
  template:
    metadata:
      labels: *labels
    spec:
      volumes:
      - name: base-config
        configMap:
          name: dovecot
      - name: config
        emptyDir: {}
      - name: indexes
        emptyDir: {}
      - name: mail
        persistentVolumeClaim:
          claimName: mail
      - name: mysql
        secret:
          secretName: maildb.kodo.org.uk
      - name: tls
        secret:
          secretName: imap.kodo.org.uk
      - name: rundir
        emptyDir: {}

      containers:
      - name: dovecot
        command: [/usr/sbin/dovecot, -F]
        volumeMounts:
        - name: config
          mountPath: /etc/dovecot/conf.d/
        - name: indexes
          mountPath: /var/indexes
        - name: mail
          mountPath: /var/mail
        - name: tls
          mountPath: /etc/tls/
        - name: rundir
          mountPath: /run/dovecot

      initContainers:
      - name: init
        image: busybox:latest
        volumeMounts:
        - name: base-config
          mountPath: /source
        - name: config
          mountPath: /config
        - name: mail
          mountPath: /mail
        - name: mysql
          mountPath: /secrets
        command:
        - sh
        - -c
        - |
          . /secrets/pass.cnf
          mkdir -p /var/mail/virtual
          chown 5000:5000 /var/mail/virtual
          cp -Lr /source/* /config
          cat <<END_CONF >>/config/sql-site.conf.ext
          driver = mysql
          connect = host=dex.kodo.org.uk dbname=app_accounts user=$username password=$password
          END_CONF
      # - name: migrate
      #   image: docker.kodo.org.uk/docker/dovecot:2.3.19-1
      #   command: ["doveadm", "sync", "-f", "-A", "imap.default.svc.cluster.local"]
      #   volumeMounts:
      #   - name: config
      #     mountPath: /etc/dovecot/conf.d/
      #   - name: rundir
      #     mountPath: /run/dovecot

kustomization.yaml

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

resources:
- https://code.kodo.org.uk/docker/dovecot//kustomize/?ref=main
- volume-claim.yaml
- certificate.yaml
- service-imap.yaml
- service-dovecot.yaml
- ts-imap.yaml
- ts-imaps.yaml

patches:
- path: deployment.patch.yaml

configMapGenerator:
- name: dovecot
  files:
  - conf/10-auth.conf
  - conf/10-director.conf
  - conf/10-docker-image.conf
  - conf/10-mailboxes.conf
  - conf/10-services.conf
  - conf/admin.conf
  - conf/lmtp.conf
  - conf/sql-site.conf.ext

service-dovecot.yaml

0 → 100644
+19 −0
Original line number Diff line number Diff line
apiVersion: v1
kind: Service

# Note: This is the legacy LMTP + SASL service declaration

metadata:
  name: dovecot

spec:
  selector:
    app.kubernetes.io/component: imap-server
    app.kubernetes.io/instance: legacy
  ports:
  - name: sasl
    protocol: TCP
    port: 63123
  - name: lmtp
    protocol: TCP
    port: 63124

service-imap.yaml

0 → 100644
+19 −0
Original line number Diff line number Diff line
apiVersion: v1
kind: Service

# Note: This is the legacy IMAP service declaration

metadata:
  name: imap

spec:
  selector:
    app.kubernetes.io/component: imap-server
    app.kubernetes.io/instance: legacy
  ports:
  - name: imap
    protocol: TCP
    port: 143
  - name: imaps
    protocol: TCP
    port: 993
Loading