Skip to content

Enable eventing when a Trigger is created for first time#2034

Merged
knative-prow-robot merged 11 commits into
knative:masterfrom
grac3gao-zz:issue_2012
Oct 29, 2019
Merged

Enable eventing when a Trigger is created for first time#2034
knative-prow-robot merged 11 commits into
knative:masterfrom
grac3gao-zz:issue_2012

Conversation

@grac3gao-zz
Copy link
Copy Markdown
Contributor

@grac3gao-zz grac3gao-zz commented Oct 10, 2019

Fixes #2012

Proposed Changes

  • Enable knative-eventing-injection for a namespace when both conditions are met:
  1. There is an annotation knative-eventing-injection: "enabled" in trigger
  2. This trigger is created and coupled with default broker, but the default broker doesn't present
  • Add validation for annotation knative-eventing-injection: "enabled"

Release Note


@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Oct 10, 2019
@knative-prow-robot knative-prow-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 10, 2019
@grac3gao-zz
Copy link
Copy Markdown
Contributor Author

ready to review

Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
@matzew
Copy link
Copy Markdown
Member

matzew commented Oct 11, 2019

I generally like the idea, doing this, since that makes it much easier to use

However, I feel that non-default broker could be simpler too: #1837

Comment thread pkg/reconciler/trigger/trigger.go Outdated
current.Labels = map[string]string{}
}
current.Labels["knative-eventing-injection"] = "enabled"
_, e := r.KubeClientSet.CoreV1().Namespaces().Update(current)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is every user allowed doing this?

@nachocano
Copy link
Copy Markdown
Contributor

/hold until this one lands #2027
otherwise it won't work in many cases

@nachocano
Copy link
Copy Markdown
Contributor

t non-default broker could be

I generally like the idea, doing this, since that makes it much easier to use

However, I feel that non-default broker could be simpler too: #1837

I think #1837 will involve some more work as we need to change the broker reconciler. IMO we can start with this simpler approach of just doing label injection, and then later on add that. Do you agree @matzew?

@matzew
Copy link
Copy Markdown
Member

matzew commented Oct 14, 2019

IMO we can start with this simpler approach of just doing label injection, and then later on add that. Do you agree @matzew?

yes, @nachocano

@matzew
Copy link
Copy Markdown
Member

matzew commented Oct 14, 2019

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 14, 2019
@grantr
Copy link
Copy Markdown
Contributor

grantr commented Oct 14, 2019

/hold

Need to think more about the possible race condition mentioned in #2012 (comment)

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 14, 2019
@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 15, 2019
@knative-prow-robot knative-prow-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. area/test-and-release Test infrastructure, tests or release and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 15, 2019
Comment thread pkg/apis/eventing/v1alpha1/trigger_validation.go Outdated
Comment thread pkg/apis/eventing/v1alpha1/trigger_validation.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
Comment thread pkg/reconciler/trigger/trigger.go Outdated
@grac3gao-zz
Copy link
Copy Markdown
Contributor Author

/retest

@grac3gao-zz
Copy link
Copy Markdown
Contributor Author

ping

@grac3gao-zz
Copy link
Copy Markdown
Contributor Author

/hold cancel

/hold until this one lands #2027
otherwise it won't work in many cases

#2027 lands

/hold

Need to think more about the possible race condition mentioned in #2012 (comment)

annotation added for race condition

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 23, 2019
Copy link
Copy Markdown
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

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

This is close! I have a few suggestions and nits.

Comment thread pkg/apis/eventing/v1alpha1/trigger_types.go Outdated
Comment thread pkg/apis/eventing/v1alpha1/trigger_validation.go Outdated
Comment thread pkg/apis/eventing/v1alpha1/trigger_validation.go Outdated
Comment thread pkg/reconciler/trigger/trigger_test.go
@grac3gao-zz
Copy link
Copy Markdown
Contributor Author

done

Comment thread pkg/reconciler/trigger/trigger_test.go
@knative-prow-robot
Copy link
Copy Markdown
Contributor

knative-prow-robot commented Oct 29, 2019

@grac3gao: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-knative-eventing-go-coverage 64be65a link /test pull-knative-eventing-go-coverage

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

Copy link
Copy Markdown
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

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

/lgtm

Looks like there's a conflict. I'll lgtm again when that's fixed.

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 29, 2019
# Conflicts:
#	pkg/apis/eventing/v1alpha1/trigger_validation_test.go
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 29, 2019
@knative-metrics-robot
Copy link
Copy Markdown

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

File Old Coverage New Coverage Delta
pkg/apis/eventing/v1alpha1/trigger_validation.go 98.5% 97.3% -1.2
pkg/reconciler/trigger/trigger.go 86.0% 83.8% -2.2

Copy link
Copy Markdown
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 29, 2019
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: grac3gao, grantr

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

The pull request process is described here

Details 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

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. area/test-and-release Test infrastructure, tests or release cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable eventing when a Trigger is created for first time

10 participants