-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Optionally emit events during execution #2082
Comments
/kind feature |
@bobcatfish I've been thinking about this for a bit, and I think it would be great to have the ability to specify a sink in the It gets a bit more complicated than just a sink though, since we might need to:
A lot of those might be avoided when using tekton triggers by using a single EventListener with multiple triggers and CEL filters to select the right thing to select. This is highly related to the notification work too, as I think the basic infrastructure required in the controller to make this happen is the same as that needed for notifications. |
/assign |
As a starting point, I think it's a fair assumption to let receivers / channels filter events, and err on the side of sending too many events, in favour of a lean syntax on Tekton side. Options for the field name:
Similar syntax for |
This might just be an implementation detail, but one option to consider is have the pipeline controller only "generate" Tekton lifecycle Kubernetes events and then leave the decision on CloudEvents or http endpoints up to a sub-project with a controller that listens for the Tekton events and distributes them. We actually need the Kubernetes events in our service's "agent" already so this would simplify our implementation. |
I think we can do both, aka : by default sending k8s events, and if |
I really like the ease-of-use of the proposed syntax, and pushing the responsibility of filtering the events to the receiver rather than Tekton. Per discussion in the WG just now, I wanted to put forward a use case that might affect the design a little bit: A team authors their organization's Tasks and Pipelines. That team wants to ensure that every Run emits cloudEvents to a specific set of endpoints for monitoring / data collection / regulatory requirements. With the current design each developer team, who mostly write Runs, has to remember to include the cloudEvents end points in those Runs. So I wonder if there is a way to set the "default" set of endpoints that every Run receives. Three options we talked about on the call:
After thinking about it a little bit I like number 2 the best so far. I can also see that there are different levels of granularity here: 1 is Pipeline / Task specific, 2 is global, 3 is Run-specific but with stricter validation that endpoints were included. Another wrinkle: Do we merge the |
Thank you @sbwsg for your feedback and for capturing the WG discussion here. My favourite option would be (2), i.e. use sinks from a global configmap, and send cloud events for all lifecycle events for all tasks/pipelines. Other options are not necessarily orthogonal, so we could also add them as we need in future. The way I would go about implementing this is:
How does this sound? |
Cheers @afrittoli Sounds like a really solid approach to me! |
I will also address #2328 as part of this work |
Start emitting events for additional TaskRun lifecyle events: - taskrun started - taskrun timeout Introduce pre-run and post-run functions that are invoked asynchronously when the taskrun starts and completes, to emit events. These same functions shall be used to trigger any other async behaviour on start/stop of taskruns. Add documentation on events. Fixes tektoncd#2328 Work towards tektoncd#2082
Start emitting events for additional TaskRun lifecyle events: - taskrun started - taskrun timeout Introduce pre-run and post-run functions that are invoked asynchronously when the taskrun starts and completes, to emit events. These same functions shall be used to trigger any other async behaviour on start/stop of taskruns. Add documentation on events. Fixes tektoncd#2328 Work towards tektoncd#2082
Note: priorities for this issue are emitting events at end of Pipeline and Task execution, #742 additionally adds after step execution |
Is this the intended replacement for CloudEvent PipelineResources in the future, since PipelineResources are more-or-less deprecated in the latest release of Tekton? |
This will provide more than we can achieve with Resources are not officially deprecated, but likely they will either reworked or replaced. In either case the cloud event resource might go away since it doesn't really fit the same pattern as other pipeline resource, its functionality is not executed in injected steps but in the controller. |
Start emitting events for additional TaskRun lifecyle events: - taskrun started - taskrun timeout Introduce pre-run and post-run functions that are invoked asynchronously when the taskrun starts and completes, to emit events. These same functions shall be used to trigger any other async behaviour on start/stop of taskruns. Add documentation on events. Fixes tektoncd#2328 Work towards tektoncd#2082
Start emitting events for additional TaskRun lifecyle events: - taskrun started - taskrun timeout Introduce pre-run and post-run functions that are invoked asynchronously when the taskrun starts and completes, to emit events. These same functions shall be used to trigger any other async behaviour on start/stop of taskruns. Add documentation on events. Fixes tektoncd#2328 Work towards tektoncd#2082
Start emitting events for additional TaskRun lifecyle events: - taskrun started - taskrun timeout Introduce pre-run and post-run functions that are invoked asynchronously when the taskrun starts and completes, to emit events. These same functions shall be used to trigger any other async behaviour on start/stop of taskruns. Add documentation on events. Fixes tektoncd#2328 Work towards tektoncd#2082
Emit events for additional TaskRun lifecyle events: - taskrun started - taskrun timeout Introduce pre-run and post-run functions that are invoked asynchronously when the taskrun starts and completes, to emit events. These same functions shall be used to trigger any other async behaviour on start/stop of taskruns. Add documentation on events. Fixes tektoncd#2328 Work towards tektoncd#2082
Move both events.go and the cloudevents module under a new module reconciler.events. We want to the controllers to be able to emit both kubernetes events and cloudevents, so this change is in preparation to creating a common event interface to be used by controllers. Partially addresses tektoncd#2082
Move both events.go and the cloudevents module under a new module reconciler.events. We want to the controllers to be able to emit both kubernetes events and cloudevents, so this change is in preparation to creating a common event interface to be used by controllers. Partially addresses #2082
There is also Eventrouter that can forward Kubernetes |
The reason why I'd like to emit cloud events directly, either from the main controller or from a dedicated one, is that k8s events have a fixed structure and afaik do not allow storing the whole source object in the event. |
Change the event type string for taskruns from dev.tekton.event.task.* to dev.tekton.event.taskrun.*. Since cloud events are only sent by pipeline resources - which are alpha - we don't need to comply with the beta deprecation policy for this. Extend the cloudevents module to include more event types for TaskRuns and event types for PipelineRuns, with unit test coverage. This is achieved by introducing the RunsToCompletion and RunsToCompletionStatus interface which are met by TaskRun, PipelineRun and their respective status types. At this stage there is no event producer that generates these new events. This is preparing the stage for the next changes where we will start to emit cloud events in addition to the k8s events we emit today. Partially addresses tektoncd#2082 Partially addresses tektoncd#2684
Change the event type string for taskruns from dev.tekton.event.task.* to dev.tekton.event.taskrun.*. Since cloud events are only sent by pipeline resources - which are alpha - we don't need to comply with the beta deprecation policy for this. Extend the cloudevents module to include more event types for TaskRuns and event types for PipelineRuns, with unit test coverage. This is achieved by introducing the RunsToCompletion and RunsToCompletionStatus interface which are met by TaskRun, PipelineRun and their respective status types. At this stage there is no event producer that generates these new events. This is preparing the stage for the next changes where we will start to emit cloud events in addition to the k8s events we emit today. Partially addresses tektoncd#2082 Partially addresses tektoncd#2684 Signed-off-by: Andrea Frittoli <[email protected]>
Change the event type string for taskruns from dev.tekton.event.task.* to dev.tekton.event.taskrun.*. Since cloud events are only sent by pipeline resources - which are alpha - we don't need to comply with the beta deprecation policy for this. Extend the cloudevents module to include more event types for TaskRuns and event types for PipelineRuns, with unit test coverage. This is achieved by introducing the RunsToCompletion and RunsToCompletionStatus interface which are met by TaskRun, PipelineRun and their respective status types. At this stage there is no event producer that generates these new events. This is preparing the stage for the next changes where we will start to emit cloud events in addition to the k8s events we emit today. Partially addresses tektoncd#2082 Partially addresses tektoncd#2684 Signed-off-by: Andrea Frittoli <[email protected]>
Change the event type string for taskruns from dev.tekton.event.task.* to dev.tekton.event.taskrun.*. Since cloud events are only sent by pipeline resources - which are alpha - we don't need to comply with the beta deprecation policy for this. Extend the cloudevents module to include more event types for TaskRuns and event types for PipelineRuns, with unit test coverage. This is achieved by introducing the RunsToCompletion and RunsToCompletionStatus interface which are met by TaskRun, PipelineRun and their respective status types. At this stage there is no event producer that generates these new events. This is preparing the stage for the next changes where we will start to emit cloud events in addition to the k8s events we emit today. Partially addresses tektoncd#2082 Partially addresses tektoncd#2684 Signed-off-by: Andrea Frittoli <[email protected]>
Change the event type string for taskruns from dev.tekton.event.task.* to dev.tekton.event.taskrun.*. Since cloud events are only sent by pipeline resources - which are alpha - we don't need to comply with the beta deprecation policy for this. Extend the cloudevents module to include more event types for TaskRuns and event types for PipelineRuns, with unit test coverage. This is achieved by introducing the RunsToCompletion and RunsToCompletionStatus interface which are met by TaskRun, PipelineRun and their respective status types. At this stage there is no event producer that generates these new events. This is preparing the stage for the next changes where we will start to emit cloud events in addition to the k8s events we emit today. Partially addresses tektoncd#2082 Partially addresses tektoncd#2684 Signed-off-by: Andrea Frittoli <[email protected]>
Change the event type string for taskruns from dev.tekton.event.task.* to dev.tekton.event.taskrun.*. Since cloud events are only sent by pipeline resources - which are alpha - we don't need to comply with the beta deprecation policy for this. Extend the cloudevents module to include more event types for TaskRuns and event types for PipelineRuns, with unit test coverage. This is achieved by introducing the RunsToCompletion and RunsToCompletionStatus interface which are met by TaskRun, PipelineRun and their respective status types. At this stage there is no event producer that generates these new events. This is preparing the stage for the next changes where we will start to emit cloud events in addition to the k8s events we emit today. Partially addresses tektoncd#2082 Partially addresses tektoncd#2684 Signed-off-by: Andrea Frittoli <[email protected]>
Change the event type string for taskruns from dev.tekton.event.task.* to dev.tekton.event.taskrun.*. Since cloud events are only sent by pipeline resources - which are alpha - we don't need to comply with the beta deprecation policy for this. Extend the cloudevents module to include more event types for TaskRuns and event types for PipelineRuns, with unit test coverage. This is achieved by introducing the RunsToCompletion and RunsToCompletionStatus interface which are met by TaskRun, PipelineRun and their respective status types. At this stage there is no event producer that generates these new events. This is preparing the stage for the next changes where we will start to emit cloud events in addition to the k8s events we emit today. Partially addresses #2082 Partially addresses #2684 Signed-off-by: Andrea Frittoli <[email protected]>
Hi @afrittoli , I am genuinely staggered by your hard work. Thanks so much for doing this! I got one question: |
Hi @tom24d, thank you for your interest in this topic. The way I imagined this is that the administrator of a Tekton deployment would configure the target URL for cloud events. Your question makes me wonder if we should support a list of sinkURI instead of a single one? Once #2837 is finished I will add a similar PR for pipelineruns, and later I plan to enabled configuring a sinkURI at taskrun and pipelinerun level, to allow for better granularity. |
If there is no problem for that idea, I think that gonna make the basic way for third party actor! 😀 Thanks! |
Yes, with #2837 you will be able to set the |
I would think it would make sense to support more than one sink indead 🙃 |
As per discussion during the API WG on 13/07/20 we will not support for now any option beyond the single sink in the platform wide configuration. The following use cases:
One concern with this approach is the volume of events sent. Right now it's all or nothing, and in case of tasks and pipelines running in different namespaces, they would have to report events to a central broker, which may raise concerns in terms of traffic separation. If Tekton users will start using cloud events, they may report on missing features and those will be addressed via dedicated TEPs / PRs. |
Expected Behavior
Although a user can use the CloudEvent PipelineResource to emit events during a TaskRun or PipelineRun, some folks may want this to happen by default, for significant events such as:
Actual Behavior
The CloudEvent PipelineResource is the only option for this right now, but even that needs #1684 before it can be relied on (see #2053)
Additional info
The text was updated successfully, but these errors were encountered: