eventing icon indicating copy to clipboard operation
eventing copied to clipboard

Support `one-offs` for firing events only once

Open embano1 opened this issue 2 years ago • 10 comments

Problem

As a user I want to fire (schedule) an action (alarm/script) or event once at a particular time. This can be done by emitting an event "once" (ignoring distr. sys challenges for a second) with customizable data at a particular point in time.

cc/ @lionelvillard

Links:

  • https://twitter.com/embano1/status/1511613644777439234?s=20&t=XN6gjYCX3lXsFWLAaKp-Hg
  • https://knative.slack.com/archives/C9JP909F0/p1649248557443529?thread_ts=1649234703.449399&cid=C9JP909F0

Persona: Developers, DevOps, operators

Exit Criteria A Knative resource which lets a user fire an event once at a particular time.

  • Specify data for event which should be fired
  • Specify start (optionally end) timeframe for which the event should be valid (TTL?)

Time Estimate (optional): 1 week.

Additional context (optional)

Evaluated but not meeting exit criteria:

  • Knative PingSource: follows cron pattern, i.e. recurring schedule and not "only once"
  • Kubernetes Job with suspension which requires a custom controller (logic) and has not simple UX in my opinion (also is not event-oriented)

embano1 avatar Apr 06 '22 14:04 embano1

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

github-actions[bot] avatar Jul 07 '22 01:07 github-actions[bot]

@lionelvillard what do you think?

pierDipi avatar Aug 08 '22 07:08 pierDipi

/remove-lifecycle stale

lionelvillard avatar Aug 08 '22 12:08 lionelvillard

this is a very useful feature.

lionelvillard avatar Aug 08 '22 12:08 lionelvillard

@lionelvillard I made a simple analysis and came up with a few questions. Would you like to share your opinion?

If we want to implement such an event with a dedicated adapter e.g. "onceadapter" in knative/eventing, there will be a lot duplicated codes similar as pingsource adapter. If we don't want duplicated code, we can just leverage "pingsource" adapter and extend it to support "one-off" event. We introduce a new Runner "oneOffJobRunner" similar as "cronJobsRunner". Then we will use the same event type "PingSource" to support the one-off event.

Another choice is to introduce a new event type in knative-sandbox with a separated repo. Then it will be a new event type and will include the whole structure of a new event source.

Which one do you prefer?

daisy-ycguo avatar Aug 29 '22 08:08 daisy-ycguo

@daisy-ycguo I'm also thinking of extending the current PingSource to support firing events only once. We need to:

  • extend the PingSource API with a new date field (similar to OpenWhisk Alarms)
  • introduce a new Runner.

So +1 on your proposal!

lionelvillard avatar Aug 31 '22 13:08 lionelvillard

/assign

daisy-ycguo avatar Sep 29 '22 08:09 daisy-ycguo

Should we also think about some form of garbage collection for one-off pings?

It seems like the right time to discuss this since it could be the default behavior of a one-off ping source.

pierDipi avatar Sep 29 '22 11:09 pierDipi

Sorry I dont have time to work on it recently. /unassign

daisy-ycguo avatar Oct 18 '22 01:10 daisy-ycguo

/assign

liuchangyan avatar Dec 07 '22 01:12 liuchangyan