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

Initial implementation for trigger groups #1052

Closed

Conversation

jmcshane
Copy link
Contributor

@jmcshane jmcshane commented Apr 14, 2021

Changes

Initial demo of using trigger groups to process eventlistener requests

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Release Notes

Implement triggerGroups and interceptor chains

@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Apr 14, 2021
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign iancoffey
You can assign the PR to them by writing /assign @iancoffey in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 14, 2021
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.7% 90.3% -7.4
pkg/sink/sink.go 79.0% 56.4% -22.6
pkg/template/resource.go 100.0% 90.5% -9.5

@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 15, 2021
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.7% 93.5% -4.2
pkg/sink/sink.go 79.0% 72.6% -6.4

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.7% 93.5% -4.2
pkg/sink/sink.go 79.0% 66.5% -12.5

@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 16, 2021
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.7% 97.8% 0.1
pkg/sink/sink.go 79.0% 66.5% -12.5
test/builder/eventlistener.go 81.5% 79.8% -1.7

@jmcshane jmcshane force-pushed the feature/trigger-groups-implementation branch from 5232a70 to 0d14397 Compare April 16, 2021 01:56
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.7% 97.8% 0.1
pkg/sink/sink.go 79.0% 66.5% -12.5
test/builder/eventlistener.go 81.5% 79.8% -1.7

@jmcshane jmcshane force-pushed the feature/trigger-groups-implementation branch from 0d14397 to 786b15b Compare April 16, 2021 02:03
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.7% 97.8% 0.1
pkg/sink/sink.go 79.0% 66.5% -12.5
test/builder/eventlistener.go 81.5% 81.9% 0.4

@jmcshane jmcshane force-pushed the feature/trigger-groups-implementation branch from 786b15b to c317287 Compare April 16, 2021 02:06
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.7% 97.8% 0.1
pkg/sink/sink.go 79.0% 66.5% -12.5
test/builder/eventlistener.go 81.5% 81.9% 0.4

@jmcshane jmcshane force-pushed the feature/trigger-groups-implementation branch from c317287 to 47a1463 Compare April 16, 2021 14:15
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.7% 97.8% 0.1
pkg/sink/sink.go 79.0% 66.5% -12.5
test/builder/eventlistener.go 81.5% 81.9% 0.4

@jmcshane jmcshane force-pushed the feature/trigger-groups-implementation branch from 47a1463 to a418ffc Compare April 16, 2021 14:41
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Apr 16, 2021
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.7% 97.8% 0.1
pkg/sink/sink.go 79.0% 74.2% -4.8
test/builder/eventlistener.go 81.5% 81.9% 0.4

@jmcshane jmcshane force-pushed the feature/trigger-groups-implementation branch from a418ffc to f886d40 Compare April 16, 2021 14:53
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.7% 97.8% 0.1
pkg/sink/sink.go 79.0% 79.3% 0.2
test/builder/eventlistener.go 81.5% 81.9% 0.4

@jmcshane jmcshane marked this pull request as ready for review April 16, 2021 14:56
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 16, 2021
@jmcshane
Copy link
Contributor Author

jmcshane commented Apr 16, 2021

@dibyom @afrittoli @wlynch this implementation is now ready in line with our discussion for TEP-0053. I reduced the changes that are a part of this PR to the absolute simplest possible, including maintaining the response code validation. The key reason I kept the response codes in here for now is because of the huge test surface that depends on this response code and expects the HTTP function to block until all resources are created.

I think it makes sense to open a separate issue to track discussion on how we manage the HTTP status code. For now, this PR is ready from a code perspective. I think what we need to finish it are:

  • Documentation about triggerGroups in the eventlistener document
  • Example eventlistener configuration including triggergroups

Please let me know if there is anything else you would like to see in this PR.

@dibyom
Copy link
Member

dibyom commented Apr 23, 2021

The key reason I kept the response codes in here for now is because of the huge test surface that depends on this response code and expects the HTTP function to block until all resources are created.

Sounds good. We can tackle that separately as part of #931

Copy link
Member

@dibyom dibyom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't gone through all of the code yet. But yes, docs and examples would be the two remaining things.
Also, we should update the release notes section of the PR to something a bit more descriptive -- (Adds a way to group common interceptors across multiple triggers ...)

trItems, err := r.selectTriggers(el.Spec.NamespaceSelector, el.Spec.LabelSelector)
if err != nil {
r.Logger.Errorf("Unable to select configured triggers: %s", err)
response.WriteHeader(http.StatusInternalServerError)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we return some info in the HTTP response as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What info are you considering here to return besides the downstream error message?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking something along the lines of a generic error message (like the unable to select configured triggers) along with the usual debugging pointers (eventID, eventListenerUID) so that its easy to look for in the logs. What do you think?

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 4, 2021
@jmcshane jmcshane force-pushed the feature/trigger-groups-implementation branch from f886d40 to bebe3a2 Compare May 4, 2021 17:30
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 4, 2021
@jmcshane jmcshane force-pushed the feature/trigger-groups-implementation branch 2 times, most recently from 1d36627 to bde9e40 Compare May 4, 2021 18:21
@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 4, 2021
@jmcshane
Copy link
Contributor Author

jmcshane commented May 4, 2021

/test pull-tekton-triggers-go-coverage

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.8% 97.9% 0.1
pkg/interceptors/server/server.go 82.1% 82.5% 0.4
pkg/sink/sink.go 79.0% 79.3% 0.2

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 5, 2021
This feature allows an operator to specify a set of interceptors that will be executed
before a group of triggers are selected and executed. This allows common data
to be passed from interceptor execution down to multiple triggers to solve
a set of common use cases across multiple Triggers.

This feature is enabled for now inline in the EventListener spec, but in the future
may be enabled only in alpha once the feature gates proposal is implemented within
this project.
@jmcshane jmcshane force-pushed the feature/trigger-groups-implementation branch from bde9e40 to 18f81b9 Compare May 6, 2021 03:03
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 6, 2021
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 97.8% 97.9% 0.1
pkg/interceptors/server/server.go 82.1% 82.5% 0.4
pkg/sink/sink.go 79.0% 79.3% 0.2

@jmcshane
Copy link
Contributor Author

jmcshane commented May 6, 2021

/test pull-tekton-triggers-integration-tests

@tekton-robot
Copy link

@jmcshane: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 8, 2021
@dibyom dibyom added this to the Triggers v0.17 milestone Sep 29, 2021
@dibyom dibyom mentioned this pull request Oct 1, 2021
4 tasks
@savitaashture
Copy link
Contributor

PR handled as part of this #1232

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants