0z5a opened a new issue, #6971:
URL: https://github.com/apache/camel-k/issues/6971

   ### Bug description
   
   An integration starting from `quartz:trigger?cron=0+0+9+?+*+2` (09:00 on 
Mondays in Quartz, where days are 1-7 = SUN-SAT) is turned by the cron trait 
into a CronJob with schedule `0 9 ? * 2`. Kubernetes numbers days 0-6 = 
SUN-SAT, so the job runs on Tuesdays. `2-6` (MON-FRI) becomes TUE-SAT. The same 
happens with `cron:tab?schedule=0+0+9+?+*+2-6`. Because the trait replaces the 
route consumer with a one-shot timer, the CronJob schedule is the only trigger, 
so the integration silently runs on the wrong days.
   
   Quartz-only values are copied too: `1,7` (SUN,SAT) gives a schedule 
Kubernetes rejects ("end of range (7) above maximum (6)"), and so do `6L` and 
`6#3`.
   
   Expected: the day-of-week numbers are converted to the CronJob numbering 
(`2` -> `1`, `2-6` -> `1-5`, `1,7` -> `0,6`), or no CronJob is derived when the 
field has no equivalent, so the Camel implementation is used.
   
   The cause is `toKubernetesCronSchedule` in `pkg/trait/cron.go`: it drops the 
seconds and year fields but keeps the day-of-week field unchanged. References: 
the Quartz CronTrigger docs list day-of-week values as "1-7 or SUN-SAT", and 
the Kubernetes CronJob docs as "day of the week (0 - 6) (Sunday to Saturday)".
   
   I have a fix with tests and will open a PR for it.
   
   ### Camel K or runtime version
   
   main (d37175cd7)
   
   This issue was drafted with Claude Code (claude-opus-5-5) on behalf of 
@0z5a; the results above are from the runs described.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to