---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: trash-updater
  namespace: media
spec:
  schedule: "@weekly"
  concurrencyPolicy: "Forbid"
  successfulJobsHistoryLimit: 1
  failedJobsHistoryLimit: 5
  jobTemplate:
    metadata:
      annotations:
        botkube.io/disable: "true"
    spec:
      backoffLimit: 3
      ttlSecondsAfterFinished: 300
      template:
        metadata:
          annotations:
            botkube.io/disable: "true"
        spec:
          restartPolicy: Never
          containers:
            - name: trash-updater-sonarr
              image: ghcr.io/sob/trash-updater@sha256:f23dee6b6ed7218affe6dc4f41b427be953b1039a9c3831d29ceb6e85e1d4ac0
              imagePullPolicy: Always
              env:
                - name: DOTNET_SYSTEM_GLOBALIZATION_INVARIANT
                  value: "1"
              command:
                - "/app/trash"
                - "sonarr"
                - "--config"
                - "/opt/trash.yaml"
              volumeMounts:
                - name: config
                  mountPath: /opt/trash.yaml
                  subPath: trash.yaml
                  readOnly: true
            - name: trash-updater-radarr
              image: ghcr.io/sob/trash-updater@sha256:f23dee6b6ed7218affe6dc4f41b427be953b1039a9c3831d29ceb6e85e1d4ac0
              imagePullPolicy: Always
              env:
                - name: DOTNET_SYSTEM_GLOBALIZATION_INVARIANT
                  value: "1"
              command:
                - "/app/trash"
                - "radarr"
                - "--config"
                - "/opt/trash.yaml"
              volumeMounts:
                - name: config
                  mountPath: /opt/trash.yaml
                  subPath: trash.yaml
                  readOnly: true
          volumes:
            - name: config
              configMap:
                name: trash-updater-config
