apiVersion: batch/v1
kind: CronJob
metadata:
  name: mindforge-cronjob
  namespace: mindforge
spec:
  schedule: "0 9 * * 6"
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            app: mindforge-cronjob
        spec:
          containers:
            - name: mindforge-cronjob
              image: git.ivanch.me/ivanch/mindforge-cronjob:latest
              imagePullPolicy: Always
              env:
                - name: GIT_REPOSITORY
                  valueFrom:
                    secretKeyRef:
                      name: mindforge-secrets
                      key: GIT_REPOSITORY
                - name: GEMINI_API_KEY
                  valueFrom:
                    secretKeyRef:
                      name: mindforge-secrets
                      key: GEMINI_API_KEY
                - name: OPENAI_API_KEY
                  valueFrom:
                    secretKeyRef:
                      name: mindforge-secrets
                      key: OPENAI_API_KEY
                - name: DISCORD_WEBHOOK_URL
                  valueFrom:
                    secretKeyRef:
                      name: mindforge-secrets
                      key: DISCORD_WEBHOOK_URL
                - name: HAVEN_NOTIFY_URL
                  valueFrom:
                    secretKeyRef:
                      name: mindforge-secrets
                      key: HAVEN_NOTIFY_URL
                - name: SUMMARY_CREATOR_PROVIDER
                  value: gemini
                - name: SUMMARY_FORMATTER_PROVIDER
                  value: openai
                - name: GEMINI_MODEL
                  value: gemini-3-flash-preview
                - name: OPENAI_MODEL
                  value: gpt-5-mini
                - name: TOP_N_FILES
                  value: "10"
                - name: LAST_N_DAYS
                  value: "7"
              resources:
                requests:
                  memory: "256Mi"
                  cpu: "1"
                limits:
                  memory: "512Mi"
                  cpu: "2"
              volumeMounts:
                - name: ssh-key
                  mountPath: /root/.ssh/id_rsa
                  subPath: id_rsa
                  readOnly: true
          restartPolicy: OnFailure
          volumes:
            - name: ssh-key
              secret:
                secretName: mindforge-secrets
                items:
                  - key: SSH_PRIVATE_KEY
                    path: id_rsa
                defaultMode: 0400
