apiVersion: batch/v1
kind: CronJob
metadata:
  name: roundcube-cleandb
  labels:
    app.kubernetes.io/controller: cleandb
    app.kubernetes.io/instance: roundcube
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: roundcube
    helm.sh/chart: roundcube-4.5.0
  namespace: roundcube
spec:
  suspend: false
  concurrencyPolicy: Forbid
  startingDeadlineSeconds: 90
  timeZone: US/Central
  schedule: "30 4 * * *"
  successfulJobsHistoryLimit: 1
  failedJobsHistoryLimit: 1
  jobTemplate:
    spec:
      parallelism: 1
      backoffLimit: 3
      template:
        metadata:
          annotations:
            checksum/configMaps: fb5b79e14a16673def67423a38952ae1855171d07a8332d9e863febcd28fce92
          labels:
            app.kubernetes.io/controller: cleandb
            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
          restartPolicy: Never
          containers:
            - args:
                - bin/cleandb.sh
              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: tls://stalwart.stalwart
                - name: ROUNDCUBEMAIL_SMTP_SERVER
                  value: tls://stalwart.stalwart
                - name: ROUNDCUBEMAIL_SKIN
                  value: elastic
                - name: ROUNDCUBEMAIL_PLUGINS
                  value: archive,zipdownload,newmail_notifier
              image: roundcube/roundcubemail:1.6.12-fpm-alpine
              imagePullPolicy: IfNotPresent
              name: backup
              resources:
                requests:
                  cpu: 100m
                  memory: 128Mi
