From fa8a5c1f6d718a9312470c9d6dca8091acf0c42a Mon Sep 17 00:00:00 2001 From: Claudio Miranda Date: Tue, 1 Aug 2023 15:45:38 -0300 Subject: [PATCH] Fix cron trait doc, timer usage is missing information Fix doc related to when the timer is materialized as a CronJOb --- docs/modules/ROOT/partials/apis/camel-k-crds.adoc | 5 ++++- docs/modules/traits/pages/cron.adoc | 5 ++++- pkg/apis/camel/v1/trait/cron.go | 5 ++++- resources/traits.yaml | 11 +++++++---- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc index 752e05983a..dac3aecb9c 100644 --- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc +++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc @@ -5669,8 +5669,11 @@ in order to save resources when the integration does not need to be executed. Integrations that start from the following components are evaluated by the cron trait: `timer`, `cron`, `quartz`. The rules for using a Kubernetes CronJob are the following: - - `timer`: when periods can be written as cron expressions. E.g. `timer:tick?period=60000`. + + - `timer`: when period is set in milliseconds with no remaining seconds, for example 120000. If there is any second left as in 121000 (120s and 1s) or the presence of any of these parameters (delay, repeatCount, time) then a CronJob won't be created, but a standard deployment. + - `cron`, `quartz`: when the cron expression does not contain seconds (or the "seconds" part is set to 0). E.g. + `cron:tab?schedule=0/2$\{plus}*\{plus}*\{plus}*\{plus}?` or `quartz:trigger?cron=0\{plus}0/2\{plus}*\{plus}*\{plus}*\{plus}?`. diff --git a/docs/modules/traits/pages/cron.adoc b/docs/modules/traits/pages/cron.adoc index e7b2caa17e..124ae3542c 100755 --- a/docs/modules/traits/pages/cron.adoc +++ b/docs/modules/traits/pages/cron.adoc @@ -11,8 +11,11 @@ in order to save resources when the integration does not need to be executed. Integrations that start from the following components are evaluated by the cron trait: `timer`, `cron`, `quartz`. The rules for using a Kubernetes CronJob are the following: - - `timer`: when periods can be written as cron expressions. E.g. `timer:tick?period=60000`. + + - `timer`: when period is set in milliseconds with no remaining seconds, for example 120000. If there is any second left as in 121000 (120s and 1s) or the presence of any of these parameters (delay, repeatCount, time) then a CronJob won't be created, but a standard deployment. + - `cron`, `quartz`: when the cron expression does not contain seconds (or the "seconds" part is set to 0). E.g. + `cron:tab?schedule=0/2${plus}*{plus}*{plus}*{plus}?` or `quartz:trigger?cron=0{plus}0/2{plus}*{plus}*{plus}*{plus}?`. diff --git a/pkg/apis/camel/v1/trait/cron.go b/pkg/apis/camel/v1/trait/cron.go index cb6c8582d6..33f095a875 100644 --- a/pkg/apis/camel/v1/trait/cron.go +++ b/pkg/apis/camel/v1/trait/cron.go @@ -27,8 +27,11 @@ package trait // Integrations that start from the following components are evaluated by the cron trait: `timer`, `cron`, `quartz`. // // The rules for using a Kubernetes CronJob are the following: -// - `timer`: when periods can be written as cron expressions. E.g. `timer:tick?period=60000`. +// +// - `timer`: when period is set in milliseconds with no remaining seconds, for example 120000. If there is any second left as in 121000 (120s and 1s) or the presence of any of these parameters (delay, repeatCount, time) then a CronJob won't be created, but a standard deployment. +// // - `cron`, `quartz`: when the cron expression does not contain seconds (or the "seconds" part is set to 0). E.g. +// // `cron:tab?schedule=0/2${plus}*{plus}*{plus}*{plus}?` or `quartz:trigger?cron=0{plus}0/2{plus}*{plus}*{plus}*{plus}?`. // // +camel-k:trait=cron. diff --git a/resources/traits.yaml b/resources/traits.yaml index dae6f5aa01..434e1250e1 100755 --- a/resources/traits.yaml +++ b/resources/traits.yaml @@ -351,10 +351,13 @@ traits: CronJob instead of a standard deployment, in order to save resources when the integration does not need to be executed. Integrations that start from the following components are evaluated by the cron trait: `timer`, `cron`, `quartz`. The rules - for using a Kubernetes CronJob are the following: - `timer`: when periods can - be written as cron expressions. E.g. `timer:tick?period=60000`. - `cron`, `quartz`: - when the cron expression does not contain seconds (or the "seconds" part is set - to 0). E.g. `cron:tab?schedule=0/2${plus}*{plus}*{plus}*{plus}?` or `quartz:trigger?cron=0{plus}0/2{plus}*{plus}*{plus}*{plus}?`.' + for using a Kubernetes CronJob are the following: - `timer`: when period is set + in milliseconds with no remaining seconds, for example 120000. If there is any + second left as in 121000 (120s and 1s) or the presence of any of these parameters + (delay, repeatCount, time) then a CronJob won''t be created, but a standard deployment. + - `cron`, `quartz`: when the cron expression does not contain seconds (or the + "seconds" part is set to 0). E.g. `cron:tab?schedule=0/2${plus}*{plus}*{plus}*{plus}?` + or `quartz:trigger?cron=0{plus}0/2{plus}*{plus}*{plus}*{plus}?`.' properties: - name: enabled type: bool