From 940134d72df1c7b93f06720fa784f592bf8fbb75 Mon Sep 17 00:00:00 2001 From: Ben Bernays Date: Thu, 28 Nov 2024 05:32:15 -0600 Subject: [PATCH] feat: Enable user to suspend a cronjob (#452) Users want to be able to create a cronjob but leave it disabled. This pr enables them to suspend the cronjob and when the cronjob is suspended it reduces the `startingDeadlineSeconds` value to a super low value to ensure that jobs do not get queued up --- charts/cloudquery/Chart.yaml | 2 +- charts/cloudquery/README.md | 3 ++- charts/cloudquery/templates/cronjob.yaml | 4 ++++ charts/cloudquery/values.yaml | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/charts/cloudquery/Chart.yaml b/charts/cloudquery/Chart.yaml index d97211fe..d8584e18 100644 --- a/charts/cloudquery/Chart.yaml +++ b/charts/cloudquery/Chart.yaml @@ -17,7 +17,7 @@ maintainers: # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 35.0.0 +version: 35.1.0 # -- This is the version number of the application being deployed.This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/cloudquery/README.md b/charts/cloudquery/README.md index 2aff5147..dc7e2adb 100644 --- a/charts/cloudquery/README.md +++ b/charts/cloudquery/README.md @@ -1,6 +1,6 @@ # cloudquery -![Version: 35.0.0](https://img.shields.io/badge/Version-35.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 6.0](https://img.shields.io/badge/AppVersion-6.0-informational?style=flat-square) +![Version: 35.1.0](https://img.shields.io/badge/Version-35.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 6.0](https://img.shields.io/badge/AppVersion-6.0-informational?style=flat-square) Open source high performance data integration platform designed for security and infrastructure teams. @@ -37,6 +37,7 @@ Kubernetes: `^1.8.0-0` | cronJobLimit | int | `3` | Number of successful cronjobs to retain. | | cronJobPodAnnotations | object | `{}` | Optional. CronJob Pod annotations. | | cronJobPodLabels | object | `{}` | Optional. CronJob Pod labels. | +| cronJobSuspend | bool | `false` | Optional. Disable the execution of the Cronjob | | deploymentAnnotations | object | `{}` | Optional. Admin Deployment annotations. | | envRenderSecret | object | `{}` | Sensible environment variables that will be rendered as new secret object This can be useful for auth tokens, etc Make sure not to commit sensitive values to git!! Better use AWS Secret manager (or any other) | | fullnameOverride | string | `""` | | diff --git a/charts/cloudquery/templates/cronjob.yaml b/charts/cloudquery/templates/cronjob.yaml index 6788abbf..df8727ac 100644 --- a/charts/cloudquery/templates/cronjob.yaml +++ b/charts/cloudquery/templates/cronjob.yaml @@ -7,6 +7,10 @@ metadata: {{- include "cloudquery.annotations" . }} spec: schedule: "{{ .Values.schedule }}" + suspend: {{ .Values.cronJobSuspend }} + {{- if .Values.cronJobSuspend }} + startingDeadlineSeconds: 5 + {{- end }} successfulJobsHistoryLimit: {{ .Values.cronJobLimit }} failedJobsHistoryLimit: {{ .Values.cronJobFailedJobsLimit }} concurrencyPolicy: Forbid diff --git a/charts/cloudquery/values.yaml b/charts/cloudquery/values.yaml index e0617557..47abedc5 100644 --- a/charts/cloudquery/values.yaml +++ b/charts/cloudquery/values.yaml @@ -151,3 +151,6 @@ cronJobPodLabels: {} # -- Optional. Additional CLI arguments to pass to the scheduled sync job (e.g. setting log format) # More information at: https://www.cloudquery.io/docs/reference/cli/cloudquery cronJobAdditionalArgs: [] + +# -- Optional. Disable the execution of the Cronjob +cronJobSuspend: false