You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cl...@apache.org on 2023/08/02 12:33:34 UTC

[camel-k] branch main updated: Fix cron trait doc, timer usage is missing information (#4633)

This is an automated email from the ASF dual-hosted git repository.

claudio4j pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new 85464ba1f Fix cron trait doc, timer usage is missing information (#4633)
85464ba1f is described below

commit 85464ba1f702a67d28caecdd12340e01b66f405c
Author: Claudio Miranda <cl...@claudius.com.br>
AuthorDate: Wed Aug 2 09:33:28 2023 -0300

    Fix cron trait doc, timer usage is missing information (#4633)
    
    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 752e05983..dac3aecb9 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 e7b2caa17..124ae3542 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 cb6c8582d..33f095a87 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 ed03494e6..da4a1ba2b 100755
--- a/resources/traits.yaml
+++ b/resources/traits.yaml
@@ -334,10 +334,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