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 support for ClusterTriggerBinding #358

Merged
merged 1 commit into from
Feb 4, 2020

Conversation

piyush-garg
Copy link
Contributor

@piyush-garg piyush-garg commented Jan 20, 2020

Changes

This will add the support for ClusterTriggerBinding
in triggers which is like TrigerBinding but
cluster-scoped

This is designed to encourage reusability across cluster
You need to add Kind field along with TriggerBinding name
to use ClusterTriggerBinding, by default it is
TriggerBinding

Add docs, examples, and tests for clustertriggerbinding

Little refactoring in code.

Add builders for multipleTriggerBindings in a trigger

Refactored e2e test to use both triggerBinding and
clusterTriggerBinding

Closes #322

Submitter Checklist

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

See the contribution guide for more details.

Release Notes

Add the support for ClusterTriggerBinding which is similar to TriggerBinding but cluster-scoped

1. To use `ClusterTriggerBinding`, you need to provide the `Kind` field along with the `Name` in Trigger. By default, it is `TriggerBinding`.

2. Modified EventListenerTrigger builder to support multiple TriggerBindings. 

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 20, 2020
@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jan 20, 2020
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.2% 79.3% -12.8
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 92.9% 0.4

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.2% 79.3% -12.8
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 92.9% 0.4

pkg/sink/sink.go Outdated Show resolved Hide resolved
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.2% 79.3% -12.8
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.0% 0.5

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.2% 79.3% -12.8
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.0% 0.5

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.2% 93.1% 0.9
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.0% 0.5

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.2% 93.1% 0.9
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.0% 0.5
test/controller.go 75.6% 75.3% -0.3

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.2% 93.1% 0.9
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.0% 0.5
test/controller.go 75.6% 75.3% -0.3

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.2% 93.1% 0.9
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.0% 0.5
test/controller.go 75.6% 75.3% -0.3

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.2% 93.1% 0.9
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.2% 0.8
test/controller.go 75.6% 75.3% -0.3

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.2% 93.1% 0.9
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.2% 0.8
test/controller.go 75.6% 75.3% -0.3

@piyush-garg
Copy link
Contributor Author

/test pull-tekton-triggers-integration-tests

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.2% 93.1% 0.9
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.2% 0.8
test/controller.go 75.6% 75.3% -0.3

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.2% 93.1% 0.9
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.2% 0.8
test/controller.go 75.6% 75.3% -0.3

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 29, 2020
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.9% 93.7% 0.8
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.2% 0.8
test/controller.go 75.6% 75.3% -0.3

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.9% 93.7% 0.8
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.2% 0.8
test/controller.go 75.6% 75.3% -0.3

examples/role-resources/role.yaml Outdated Show resolved Hide resolved
pkg/apis/triggers/v1alpha1/event_listener_validation.go Outdated Show resolved Hide resolved
pkg/apis/triggers/v1alpha1/event_listener_validation.go Outdated Show resolved Hide resolved
@@ -155,6 +153,19 @@ func TestEventListenerCreate(t *testing.T) {
t.Fatalf("Error creating TriggerBinding: %s", err)
}

// ClusterTriggerBinding
ctb, err := c.TriggersClient.TektonV1alpha1().ClusterTriggerBindings().Create(
Copy link
Member

Choose a reason for hiding this comment

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

Can we split this off into a separate test instead of adding onto existing test here since it is already pretty large?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, this is an e2e test, which was using a trigger binding. I have split that into one trigger binding and 1 cluster trigger binding and updated the test. Does it make sense to have two tests for that?

Copy link
Member

Choose a reason for hiding this comment

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

I think its ok for now...but I'm planning on adding smaller/more focussed e2e tests soon!

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.9% 93.7% 0.8
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.2% 0.8
test/controller.go 75.6% 75.3% -0.3

@piyush-garg
Copy link
Contributor Author

/test pull-tekton-triggers-integration-tests

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.9% 93.7% 0.8
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.2% 0.8
test/controller.go 75.6% 75.3% -0.3

@vdemeester
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2020
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2020
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.9% 93.7% 0.8
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.2% 0.8
test/controller.go 75.6% 75.3% -0.3

@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.9% 93.7% 0.8
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 92.5% 93.2% 0.8
test/controller.go 75.6% 75.3% -0.3

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.

Just needs a rebase! Otherwise looks good

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom, khrm

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

The pull request process is described 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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 3, 2020
This will add the support for ClusterTriggerBinding
in triggers which is like TrigerBinding but
cluster-scoped

This is designed to encourage reusability across cluster
You need to add Kind field along with TriggerBinding name
to use ClusterTriggerBinding, by default it is
TriggerBinding

Add docs, examples, and tests for clustertriggerbinding

Little refactoring in code.

Add builders for multipleTriggerBindings in a trigger

Refactored e2e test to use both triggerBinding and
clusterTriggerBinding

Closes tektoncd#322
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_defaults.go Do not exist N/A
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_types.go Do not exist 0.0%
pkg/apis/triggers/v1alpha1/cluster_trigger_binding_validation.go Do not exist 66.7%
pkg/apis/triggers/v1alpha1/event_listener_validation.go 92.9% 93.7% 0.8
pkg/apis/triggers/v1alpha1/trigger_binding_types.go Do not exist 0.0%
test/builder/clustertriggerbinding.go Do not exist 100.0%
test/builder/eventlistener.go 94.6% 95.2% 0.5
test/controller.go 75.6% 75.3% -0.3

@khrm
Copy link
Contributor

khrm commented Feb 4, 2020

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 4, 2020
@tekton-robot tekton-robot merged commit 3af33c5 into tektoncd:master Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Clusterwide TriggerBinding
6 participants