Skip to content

Instantly share code, notes, and snippets.

@cdock1029
Forked from codyzu/every-5-minutes.cron.yaml
Last active August 2, 2018 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdock1029/6465aa11f0f935d24eac0d40e203c44f to your computer and use it in GitHub Desktop.
Save cdock1029/6465aa11f0f935d24eac0d40e203c44f to your computer and use it in GitHub Desktop.
Kubernetes CronJob publishing to a PubSub topic
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: monthly-late-fee-rent
spec:
schedule: "0 6 1 * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: monthly-late-fee-rent
image: google/cloud-sdk:183.0.0-slim
args:
- /bin/sh
- -c
- gcloud beta pubsub topics publish monthly-late-fee-rent-job --message="{\"lastMonth\": $(date --date='last month' +%-m), \"thisMonth\": $(date +%-m)}"
restartPolicy: OnFailure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment