Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save garethahealy/56bc361e43cfbd70dfe9c8fc08ca0d55 to your computer and use it in GitHub Desktop.
Save garethahealy/56bc361e43cfbd70dfe9c8fc08ca0d55 to your computer and use it in GitHub Desktop.
stu
apiVersion: v1
kind: Template
labels:
template: scheduledjob-helloworld
metadata:
annotations:
description: Scheduled Task to Print HelloWorld
iconClass: icon-shadowman
tags: scheduledjob,bash
creationTimestamp: null
name: scheduledjob-helloworld
objects:
- apiVersion: batch/v2alpha1
kind: ScheduledJob
metadata:
name: ${JOB_NAME}
spec:
concurrencyPolicy: Forbid
failedJobsHistoryLimit: ${{FAILED_JOBS_HISTORY_LIMIT}}
jobTemplate:
spec:
template:
spec:
activeDeadlineSeconds: 500
containers:
- command:
- /bin/bash
- -c
- /opt/scripts/histuff-loop.sh
image: registry.access.redhat.com/rhel7/rhel:latest
name: ${JOB_NAME}
volumeMounts:
- mountPath: /opt/scripts
name: bash-scripts
dnsPolicy: ClusterFirst
restartPolicy: Never
terminationGracePeriodSeconds: 30
volumes:
- name: bash-scripts
configMap:
name: scripts
schedule: ${SCHEDULE}
successfulJobsHistoryLimit: ${{SUCCESS_JOBS_HISTORY_LIMIT}}
parameters:
- description: Name of the Scheduled Job to Create.
displayName: Job Name
name: JOB_NAME
required: true
value: scheduledjob-helloworld
- description: Cron Schedule to Execute the Job
displayName: Cron Schedule
name: SCHEDULE
required: true
value: "*/5 * * * *"
- description: The number of successful jobs that will be retained
displayName: Successful Job History Limit
name: SUCCESS_JOBS_HISTORY_LIMIT
required: true
value: "5"
- description: The number of failed jobs that will be retained
displayName: Failed Job History Limit
name: FAILED_JOBS_HISTORY_LIMIT
required: true
value: "5"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment