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

Added EventPolicy Webhook #8091

Merged
merged 4 commits into from
Jul 19, 2024
Merged

Conversation

dharmjit
Copy link
Contributor

Fixes #7972

Proposed Changes

  • 🎁 Added EventPolicy Webhook

Release Note


Added EventPolicy Webhook

Signed-off-by: Dharmjit Singh <dharmjit.bti@gmail.com>
@knative-prow knative-prow bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 10, 2024
Copy link

knative-prow bot commented Jul 10, 2024

Hi @dharmjit. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@Leo6Leo
Copy link
Member

Leo6Leo commented Jul 10, 2024

/ok-to-test

@knative-prow knative-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 10, 2024
@Cali0707
Copy link
Member

@dharmjit could you look into the failing unit tests? If you have any questions feel free to ping me or @Leo6Leo here or on slack :)

Copy link

codecov bot commented Jul 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.87%. Comparing base (57b52ea) to head (4212eec).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8091      +/-   ##
==========================================
+ Coverage   67.80%   67.87%   +0.07%     
==========================================
  Files         367      368       +1     
  Lines       17373    17554     +181     
==========================================
+ Hits        11779    11915     +136     
- Misses       4859     4894      +35     
- Partials      735      745      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Leo6Leo Leo6Leo self-requested a review July 15, 2024 13:10
Copy link
Member

@Leo6Leo Leo6Leo left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @dharmjit !

I left 2 comments, PTAL and lmk if you have any questions!

@@ -576,6 +577,9 @@ func TestReconcile(t *testing.T) {
table.Test(t, MakeFactory(func(ctx context.Context, listers *Listers, cmw configmap.Watcher) controller.Reconciler {
ctx = channelable.WithDuck(ctx)
ctx = v1addr.WithDuck(ctx)
ctx = feature.ToContext(ctx, feature.Flags{
Copy link
Member

Choose a reason for hiding this comment

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

Here you are trying to turn on OIDC for all the tests. Should we try to use the similar pattern that is used here in broker?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Leo6Leo I think currently all test cases are written assuming that the oidc-authentication feature is enabled. We could refactor this if we wanted to add tests with oidc-authentication feature disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Leo6Leo Any inputs on this?

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 not all the test cases here are being assumed to run with oidc-authentication feature is enabled. For example here

WithChannelEventPoliciesReadyBecauseOIDCDisabled()),

Copy link
Member

Choose a reason for hiding this comment

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

Yes, following up on what @Leo6Leo said, we generally test many different configurations in these unit tests. In this scenario that means both with OIDC enabled and without OIDC enabled

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the individual test cases in the newer commit. PTAL.

pkg/apis/eventing/v1alpha1/eventpolicy_validation_test.go Outdated Show resolved Hide resolved
Signed-off-by: Dharmjit Singh <dharmjit.bti@gmail.com>
Signed-off-by: Dharmjit Singh <dharmjit.bti@gmail.com>
@Leo6Leo
Copy link
Member

Leo6Leo commented Jul 19, 2024

This look great to me, thanks again for the PR @dharmjit !
/lgtm

/cc @Cali0707

@knative-prow knative-prow bot requested a review from Cali0707 July 19, 2024 14:54
@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jul 19, 2024
Copy link
Member

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

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

/approve

Copy link

knative-prow bot commented Jul 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Cali0707, dharmjit

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

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 19, 2024
@knative-prow knative-prow bot merged commit 1e4183f into knative:main Jul 19, 2024
36 checks passed
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. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add webhook for EventPolicy
3 participants