apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: twitter-followers
spec:
  schedule: "0 * * * *"
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      activeDeadlineSeconds: 300
      template:
        spec:
          restartPolicy: OnFailure
          containers:
          - name: followers
            image: ibigbug/followers
            imagePullPolicy: Always
            env:
              - name: consumer_key
                valueFrom:
                  secretKeyRef:
                    name: twitter-credentials
                    key: consumer_key
              - name: consumer_secret
                valueFrom:
                  secretKeyRef:
                    name: twitter-credentials
                    key: consumer_secret
              - name: access_token_key
                valueFrom:
                  secretKeyRef:
                    name: twitter-credentials
                    key: access_token_key
              - name: access_token_secret
                valueFrom:
                  secretKeyRef:
                    name: twitter-credentials
                    key: access_token_secret
              - name: mailgun_apikey
                valueFrom:
                  secretKeyRef:
                    name: twitter-credentials
                    key: mailgun_apikey
              - name: redis_host
                value: redis-master
              - name: to_notify
                value: akabyw@gmail.com
