Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add native support for CronJobs #1182

Closed
nicolaferraro opened this issue Jan 8, 2020 · 2 comments · Fixed by #1197
Closed

Add native support for CronJobs #1182

nicolaferraro opened this issue Jan 8, 2020 · 2 comments · Fixed by #1197
Assignees
Labels
kind/feature New feature or request
Milestone

Comments

@nicolaferraro
Copy link
Member

To complete the Camel K "serverless experience", a simple addition would be the support for Kubernetes CronJob out of the box.

A user running an integration like:

from('timer:tick?period=1m').to('...')

Can have it materialized as cronjob.
In practice, a pod will be created by Kubernetes only when it's time to run the integration and there's no pod running between executions.

This rocks in combination with Quarkus.

There will be periods of the timer that cannot be supported (sub minute, or periods that cannot be expressed by a cron), but that should be fine, we fallback to normal implementation.

Equivalently, we can also add:

from('quartz:tick?cron=* 0/1 * * ? *').to('...')

The translation is easier, even if quartz supports 6-7 fields in the cron expression, while Kubernetes only 5 (no seconds, no years).

This requires some changes also at runtime level.

@nicolaferraro nicolaferraro added the kind/feature New feature or request label Jan 8, 2020
@nicolaferraro nicolaferraro added this to the 1.0.0-RC2 milestone Jan 8, 2020
@nicolaferraro nicolaferraro self-assigned this Jan 8, 2020
@lburgazzoli
Copy link
Contributor

lburgazzoli commented Jan 8, 2020

On the runtime side, we can use a trick similar to the one we use for knative-source, like have a cron loader that replaces the from definition with a simple time that fires immediately and only once.

Do you mind opening an issue on runtime side too?

@nicolaferraro
Copy link
Member Author

Opening.. I've sketched a solution using a different trick (customizer), so that it can be used also when you need a knative-source loader.. Will try to publish soon, so we can iterate on that

nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jan 14, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jan 14, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jan 14, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jan 14, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jan 14, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jan 14, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jan 17, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jan 17, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jan 17, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jan 17, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jan 17, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jan 17, 2020
nicolaferraro added a commit that referenced this issue Jan 22, 2020
nicolaferraro added a commit that referenced this issue Jan 22, 2020
nicolaferraro added a commit that referenced this issue Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants