apiVersion: apps/v1
kind: Deployment
metadata:
  name: cron
  labels:
    app: cron
spec:
  selector:
    matchLabels:
      app: cron
  template:
    metadata:
      labels:
        app: cron
    spec:
      imagePullSecrets:
        - name: "cr.seqera.io"
      volumes:
        - name: config-volume
          configMap:
            name: tower-yml
        # Volume for Data Studios
        #- name: cert-volume
        #  secret:
        #    secretName: platform-oidc-certs
      initContainers:
        - name: migrate-db
          image: cr.seqera.io/private/nf-tower-enterprise/migrate-db:v24.1.3
          command: ["sh", "-c", "/migrate-db.sh"]
          envFrom:
            - configMapRef:
                name: tower-backend-cfg
          volumeMounts:
            - name: config-volume
              mountPath: /tower.yml
              subPath: tower.yml
            # Volume mount for Data Studios
            #- name: cert-volume
            #  mountPath: /data/certs
      containers:
        - name: backend
          image: cr.seqera.io/private/nf-tower-enterprise/backend:v24.1.3
          envFrom:
            - configMapRef:
                name: tower-backend-cfg
          volumeMounts:
            - name: config-volume
              mountPath: /tower.yml
              subPath: tower.yml
          env:
            - name: MICRONAUT_ENVIRONMENTS
              value: "prod,redis,cron"
            # TLS certificate for Data Studios
            #- name: TOWER_OIDC_PEM_PATH
            #  value: '/data/certs/oidc.pem'
          ports:
            - containerPort: 8080
          readinessProbe:
            httpGet:
              path: /health
              port: 8080
            initialDelaySeconds: 5
            timeoutSeconds: 3
          livenessProbe:
            httpGet:
              path: /health
              port: 8080
            initialDelaySeconds: 5
            timeoutSeconds: 3
            failureThreshold: 10
