diff --git a/charts/port-ocean/README.md b/charts/port-ocean/README.md index 99ecb9b..30d2cbe 100644 --- a/charts/port-ocean/README.md +++ b/charts/port-ocean/README.md @@ -62,6 +62,8 @@ The following table lists the configuration parameters of the `port-ocean` chart | `workload.kind` | Kind of the workload. Can be either Deployment or CronJob | `Deployment` | | `workload.deployment.rolloutStrategy` | Deployment rollout strategy. | `Recreate` | | `workload.cron.resyncTimeoutMinutes` | Timeout in minutes for the resync cron job. When set to 0 or null, the cron job will not have a timeout. | `60` | +| `workload.cron.resyncOnInstall` | Should the first instllation trigger a resync job. | `true` | +| `workload.cron.resyncOnUpgrade` | Should the upgrade trigger a resync job. | `true` | | `securityContext` | Security context applied to the container. | `{}` | | `resources` | Container resource requests and limits. | `{}` | | `nodeSelector` | NodeSelector applied to the pod. | `{}` | diff --git a/charts/port-ocean/templates/cron-job/cron.yaml b/charts/port-ocean/templates/cron-job/cron.yaml index 453d691..47b9913 100644 --- a/charts/port-ocean/templates/cron-job/cron.yaml +++ b/charts/port-ocean/templates/cron-job/cron.yaml @@ -1,8 +1,8 @@ {{- if eq .Values.workload.kind "CronJob" }} {{- $maxRunTimeSeconds := "" }} -{{- if (.Values.workload.cron).resyncTimeout }} +{{- if (.Values.workload.cron).resyncTimeoutMinutes }} {{- $minute := 60 }} -{{- $maxRunTimeSeconds = (mul (.Values.workload.cron).resyncTimeout $minute )}} +{{- $maxRunTimeSeconds = (mul (.Values.workload.cron).resyncTimeoutMinutes $minute )}} {{- end }} apiVersion: batch/v1 kind: CronJob diff --git a/charts/port-ocean/templates/cron-job/installation-resync-job.yml b/charts/port-ocean/templates/cron-job/installation-resync-job.yml index ab7fe65..3122a7e 100644 --- a/charts/port-ocean/templates/cron-job/installation-resync-job.yml +++ b/charts/port-ocean/templates/cron-job/installation-resync-job.yml @@ -1,4 +1,6 @@ -{{- if and (eq .Values.workload.kind "CronJob") }} +{{- $resyncOnInstall := (.Values.workload.cron).resyncOnInstall | default true }} +{{- $resyncOnUpgrade := (.Values.workload.cron).resyncOnUpgrade | default true }} +{{- if and (eq .Values.workload.kind "CronJob") (or $resyncOnInstall $resyncOnUpgrade) }} {{- $jobName := .Release.Revision }} apiVersion: batch/v1 kind: Job diff --git a/charts/port-ocean/values.yaml b/charts/port-ocean/values.yaml index 24d2cdd..9859ecf 100644 --- a/charts/port-ocean/values.yaml +++ b/charts/port-ocean/values.yaml @@ -38,8 +38,11 @@ workload: deployment: rolloutStrategy: "Recreate" -# cron: -# resyncTimeout: 60 + cron: + # number of minutes to wait before cancelling the resync + resyncTimeoutMinutes: null + resyncOnInstall: true + resyncOnUpgrade: true resources: requests: