apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: s3-upload-cleaner
  namespace: platform-system
spec:
  schedule: "{{ .s3uploadCleaner.schedule }}"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: s3-upload-cleaner
              image: flanksource/s3-upload-cleaner:{{ .s3uploadCleaner.version }}
              command: ["/app/s3-upload-cleaner"]
              args: ["-endpoint", "{{ .s3uploadCleaner.endpoint }}", "-bucket", "{{ .s3uploadCleaner.bucket }}"]
              env:
                - name: AWS_ACCESS_KEY_ID
                  valueFrom:
                    secretKeyRef:
                      name: secrets
                      key: AWS_ACCESS_KEY_ID
                - name: AWS_SECRET_ACCESS_KEY
                  valueFrom:
                    secretKeyRef:
                      name: secrets
                      key: AWS_SECRET_ACCESS_KEY
          restartPolicy: Never
