apiVersion: apps/v1
kind: Deployment
metadata:
  name: roundcube-main
  labels:
    app.kubernetes.io/controller: main
    app.kubernetes.io/instance: roundcube
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: roundcube
    helm.sh/chart: roundcube-4.6.2
  namespace: roundcube
spec:
  revisionHistoryLimit: 3
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/controller: main
      app.kubernetes.io/name: roundcube
      app.kubernetes.io/instance: roundcube
  template:
    metadata:
      annotations:
        checksum/configMaps: fb5b79e14a16673def67423a38952ae1855171d07a8332d9e863febcd28fce92
      labels:
        app.kubernetes.io/controller: main
        app.kubernetes.io/instance: roundcube
        app.kubernetes.io/name: roundcube
    spec:
      enableServiceLinks: false
      serviceAccountName: default
      automountServiceAccountToken: true
      hostIPC: false
      hostNetwork: false
      hostPID: false
      dnsPolicy: ClusterFirst
      containers:
        - env:
            - name: ROUNDCUBEMAIL_DB_TYPE
              value: pgsql
            - name: ROUNDCUBEMAIL_DB_HOST
              valueFrom:
                secretKeyRef:
                  key: host
                  name: roundcube-postgresql-18-cluster-app
            - name: ROUNDCUBEMAIL_DB_NAME
              valueFrom:
                secretKeyRef:
                  key: dbname
                  name: roundcube-postgresql-18-cluster-app
            - name: ROUNDCUBEMAIL_DB_USER
              valueFrom:
                secretKeyRef:
                  key: user
                  name: roundcube-postgresql-18-cluster-app
            - name: ROUNDCUBEMAIL_DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: password
                  name: roundcube-postgresql-18-cluster-app
            - name: ROUNDCUBEMAIL_DES_KEY
              valueFrom:
                secretKeyRef:
                  key: DES_KEY
                  name: roundcube-key-secret
            - name: ROUNDCUBEMAIL_DEFAULT_HOST
              value: stalwart.stalwart
            - name: ROUNDCUBEMAIL_DEFAULT_PORT
              value: "143"
            - name: ROUNDCUBEMAIL_SMTP_SERVER
              value: stalwart.stalwart
            - name: ROUNDCUBEMAIL_SMTP_PORT
              value: "25"
            - name: ROUNDCUBEMAIL_SKIN
              value: elastic
            - name: ROUNDCUBEMAIL_PLUGINS
              value: archive,zipdownload,newmail_notifier
          image: roundcube/roundcubemail:1.6.12-fpm-alpine
          imagePullPolicy: IfNotPresent
          name: main
          resources:
            requests:
              cpu: 10m
              memory: 256Mi
          volumeMounts:
            - mountPath: /var/www/html
              name: data
            - mountPath: /tmp/roundcube-temp
              name: temp
        - env:
            - name: NGINX_HOST
              value: mail.alexlebens.net
            - name: NGINX_PHP_CGI
              value: roundcube.roundcube:9000
          image: nginx:1.29.5-alpine-slim
          imagePullPolicy: IfNotPresent
          name: nginx
          resources:
            requests:
              cpu: 10m
              memory: 128Mi
          volumeMounts:
            - mountPath: /etc/nginx/conf.d/default.conf
              mountPropagation: None
              name: config
              readOnly: true
              subPath: default.conf
            - mountPath: /var/www/html
              name: data
      volumes:
        - configMap:
            name: roundcube-config
          name: config
        - name: data
          persistentVolumeClaim:
            claimName: roundcube-data
        - emptyDir: {}
          name: temp
