apiVersion: batch/v1
kind: CronJob
metadata:
  name: tweet-taiwan-air-quality
spec:
  schedule: "0 */4 * * *"
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 2
  failedJobsHistoryLimit: 2
  jobTemplate:
    spec:
      template:
        spec:
          volumes:
            - name: twitter-token
              secret:
                secretName: taiwan-air-quality-bot-twitter-token
          containers:
            - name: tweet-taiwan-air-quality
              image: gugod/taiwan-air-quality-bot:latest
              command:
                - perl
                - /app/bin/tweet.pl
                - '-c'
                - /app/secrets/twitter-token.yml
                - '--yes'
              volumeMounts:
                - name: twitter-token
                  mountPath: /app/secrets
                  readOnly: true
          restartPolicy: Never
