apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: top-post-set
spec:
  schedule: "* * * * *"
  failedJobsHistoryLimit: 1
  successfulJobsHistoryLimit: 1
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: top-post-set
            image: nathanperkins/top-post-set
            imagePullPolicy: "Always"
            resources:
              limits:
                memory: "128Mi"
                cpu: "250m"
            env:
              - name: REDDIT_USERNAME
                valueFrom:
                  secretKeyRef:
                    name: reddit-auth
                    key: username
              - name: REDDIT_PASSWORD
                valueFrom:
                  secretKeyRef:
                    name: reddit-auth
                    key: password
              - name: REDDIT_CLIENT_ID
                valueFrom:
                  secretKeyRef:
                    name: reddit-auth
                    key: client_id
              - name: REDDIT_CLIENT_SECRET
                valueFrom:
                  secretKeyRef:
                    name: reddit-auth
                    key: client_secret
              - name: REDIS_ADDR
                value: redis:6379

          restartPolicy: OnFailure
