Skip to content

Commit

Permalink
Fix cron trait doc, timer usage is missing information (#4633)
Browse files Browse the repository at this point in the history
Fix doc related to when the timer is materialized as a CronJOb
  • Loading branch information
claudio4j authored Aug 2, 2023
1 parent 4ec4694 commit 85464ba
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
5 changes: 4 additions & 1 deletion docs/modules/ROOT/partials/apis/camel-k-crds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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}?`.
Expand Down
5 changes: 4 additions & 1 deletion docs/modules/traits/pages/cron.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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}?`.


Expand Down
5 changes: 4 additions & 1 deletion pkg/apis/camel/v1/trait/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 7 additions & 4 deletions resources/traits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 85464ba

Please sign in to comment.