diff --git a/boilerplates/kubernetes/cronworkflow.yaml b/boilerplates/kubernetes/cronworkflow.yaml new file mode 100644 index 00000000..1b1cf972 --- /dev/null +++ b/boilerplates/kubernetes/cronworkflow.yaml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: CronWorkflow +metadata: + name: hello-world +spec: + schedule: "* * * * *" + timezone: "Europe/London" # Default to local machine timezone + startingDeadlineSeconds: 0 + concurrencyPolicy: "Replace" # Default to "Allow" + successfulJobsHistoryLimit: 4 # Default 3 + failedJobsHistoryLimit: 4 # Default 1 + suspend: false # Set to "true" to suspend scheduling + workflowSpec: + entrypoint: whalesay + templates: + - name: whalesay + container: + image: docker/whalesay:latest + command: [cowsay] + args: ["🕓 hello world. Scheduled on: {{workflow.scheduledTime}}"] diff --git a/kubernetes/jobs/health-dashboard-cj.yaml b/kubernetes/jobs/health-dashboard-cj.yaml index c585e3bc..8441b93b 100644 --- a/kubernetes/jobs/health-dashboard-cj.yaml +++ b/kubernetes/jobs/health-dashboard-cj.yaml @@ -11,7 +11,7 @@ spec: template: spec: containers: - - image: 192.168.7.210:5000/health-dashboard:0.0.6 + - image: 192.168.7.210:5000/health-dashboard:0.0.7 imagePullPolicy: Always name: health-dashboard resources: @@ -20,3 +20,4 @@ spec: restartPolicy: OnFailure terminationGracePeriodSeconds: 30 schedule: "0 7 * * *" + timezone: "Europe/London" diff --git a/kubernetes/jobs/user-etl-cj.yaml b/kubernetes/jobs/user-etl-cj.yaml new file mode 100644 index 00000000..ff9ab779 --- /dev/null +++ b/kubernetes/jobs/user-etl-cj.yaml @@ -0,0 +1,22 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: users-etl + namespace: cron-jobs +spec: + concurrencyPolicy: Replace + failedJobsHistoryLimit: 5 + jobTemplate: + spec: + template: + spec: + containers: + - image: 192.168.7.210:5000/user-etl:0.0.1 + imagePullPolicy: Always + name: users-etl + resources: + requests: + memory: 256Mi + restartPolicy: OnFailure + terminationGracePeriodSeconds: 30 + schedule: "0 0 * * *" diff --git a/kubernetes/registry/cron-workflows.yaml b/kubernetes/registry/cron-workflows.yaml new file mode 100644 index 00000000..e88757f5 --- /dev/null +++ b/kubernetes/registry/cron-workflows.yaml @@ -0,0 +1,30 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: cron-workflows + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: "https://github.com/mrpbennett/home-ops.git" + path: kubernetes/workflows + targetRevision: HEAD + directory: + recurse: true + destination: + namespace: cron-jobs + server: "https://kubernetes.default.svc" + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true + retry: + limit: 5 + backoff: + duration: 5s + maxDuration: 5m0s + factor: 2 diff --git a/kubernetes/workflows/cron-work-flow-test.yaml b/kubernetes/workflows/cron-work-flow-test.yaml new file mode 100644 index 00000000..914b0504 --- /dev/null +++ b/kubernetes/workflows/cron-work-flow-test.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: cron-workflows + namespace: argocd +spec: + project: default + source: + repoURL: "https://github.com/mrpbennett/home-ops.git" + path: kubernetes/workflow/jobs + targetRevision: HEAD + destination: + server: "https://kubernetes.default.svc" + namespace: cron-jobs + syncPolicy: + automated: + prune: true + selfHeal: true diff --git a/kubernetes/workflows/jobs/hello-world.yaml b/kubernetes/workflows/jobs/hello-world.yaml new file mode 100644 index 00000000..5392d0b2 --- /dev/null +++ b/kubernetes/workflows/jobs/hello-world.yaml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: CronWorkflow +metadata: + name: hello-world +spec: + schedule: "*/10 * * * *" + timezone: "Europe/London" # Default to local machine timezone + startingDeadlineSeconds: 0 + concurrencyPolicy: "Replace" # Default to "Allow" + successfulJobsHistoryLimit: 4 # Default 3 + failedJobsHistoryLimit: 4 # Default 1 + suspend: false # Set to "true" to suspend scheduling + workflowSpec: + entrypoint: whalesay + templates: + - name: whalesay + container: + image: docker/whalesay:latest + command: [cowsay] + args: ["🕓 hello world. Scheduled on: {{workflow.scheduledTime}}"]