apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: my-kubernetes-job
  labels:
    app: my-kubernetes-app
    type: cron
spec:
  schedule: "* 1 * * *" # Run every hour
  jobTemplate:
    metadata:
      labels:
        app: my-kubernetes-job
        type: cron
    spec:
      template:
        spec:
          containers:
            - name: my-kubernetes-job
              image: manusant/curl-jq
              imagePullPolicy: IfNotPresent
              env:
                - name: WEBHOOK
                  value: <your-slack-web-hook>
                - name: OAUTH_TOKEN_ENDPOINT
                  value: <yout-oauth-token-endpoint> # https://api.example.com/uaa/oauth/token
                - name: BASIC_CLIENT_CREDENTIALS
                  value: <{base64}clientId:clientSecret}> # c2NoXXX1bGVyLXNlcnZpY2U6MTIzUVdFYXNk
                - name: JOB_ENDPOINT
                  value: <http-endpointç-to-call>
                - name: CHANNEL
                  value: "#<your-slack-channel>"
                - name: SUCCESS_MESSAGE
                  value: "Your success message"
                - name: FAIL_MESSAGE
                  value: "Your error message"
              command: ["/scripts/kubernetes-curl-job.sh"]
              volumeMounts:
                - name: my-kubernetes-job-volume
                  mountPath: /scripts
          volumes:
            - name: my-kubernetes-job-volume
              configMap:
                name: kubernetes-curl-job-script
                defaultMode: 0744
          restartPolicy: Never
