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

Make auth package indepent from eventpolicy informer #8195

Conversation

creydr
Copy link
Member

@creydr creydr commented Sep 16, 2024

Currently the pkg/auth package depends on the eventpolicy informer (through the tokenverifier), requiring everything what imports knative.dev/eventing/pkg/auth to have permissions to read&list EventPolicies.
This leads to the following issues e.g. for PingSource (which does not need the TokenVerifier):

W0916 14:29:26.690900       1 reflector.go:547] k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: failed to list *v1alpha1.EventPolicy: eventpolicies.eventing.knative.dev is forbidden: User "system:serviceaccount:knative-eventing:pingsource-mt-adapter" cannot list resource "eventpolicies" in API group "eventing.knative.dev" at the cluster scope
E0916 14:29:26.690991       1 reflector.go:150] k8s.io/client-go@v0.30.3/tools/cache/reflector.go:232: Failed to watch *v1alpha1.EventPolicy: failed to list *v1alpha1.EventPolicy: eventpolicies.eventing.knative.dev is forbidden: User "system:serviceaccount:knative-eventing:pingsource-mt-adapter" cannot list resource "eventpolicies" in API group "eventing.knative.dev" at the cluster scope

This PR addresses it and removes the dependency in the TokenVerifier to the EventPolicy informer. In addition it renames the auth.OIDCTokenVerifier to auth.Verifier as this includes AuthN and AuthZ.

@knative-prow knative-prow bot requested review from aliok and matzew September 16, 2024 14:37
@knative-prow knative-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 16, 2024
Copy link

codecov bot commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 18.51852% with 22 lines in your changes missing coverage. Please review.

Project coverage is 67.48%. Comparing base (ae6ed99) to head (a459dc2).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/auth/verifier.go 0.00% 11 Missing ⚠️
cmd/jobsink/main.go 0.00% 6 Missing ⚠️
cmd/broker/filter/main.go 0.00% 2 Missing ⚠️
cmd/broker/ingress/main.go 0.00% 2 Missing ⚠️
pkg/channel/event_receiver.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8195      +/-   ##
==========================================
+ Coverage   67.47%   67.48%   +0.01%     
==========================================
  Files         371      371              
  Lines       18036    18036              
==========================================
+ Hits        12169    12171       +2     
+ Misses       5088     5087       -1     
+ Partials      779      778       -1     

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

cmd/jobsink/main.go Outdated Show resolved Hide resolved
@creydr creydr force-pushed the make-auth-package-indepent-from-eventpolicy-informer branch from 830605a to d1439f6 Compare September 17, 2024 06:33
Copy link
Member

@pierDipi pierDipi 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 knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Sep 17, 2024
Copy link

knative-prow bot commented Sep 17, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: creydr, pierDipi

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 merged commit e79f3b6 into knative:main Sep 17, 2024
34 of 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. 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.

2 participants