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

Refactor the AuthStatus Logic in Eventing OIDC Feature Track #7417

Merged
merged 12 commits into from
Nov 28, 2023

Conversation

xiangpingjiang
Copy link
Contributor

Fixes #7377

Proposed Changes

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

Refactor the AuthStatus Logic in Eventing OIDC Feature Track

Docs

@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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 29, 2023
@knative-prow
Copy link

knative-prow bot commented Oct 29, 2023

Hi @xiangpingjiang. 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/test-infra repository.

@xiangpingjiang xiangpingjiang marked this pull request as draft October 30, 2023 01:37
@knative-prow knative-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 30, 2023
@knative-prow knative-prow bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 31, 2023
@knative-prow knative-prow bot 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 Oct 31, 2023
@codecov
Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (67f382d) 76.79% compared to head (e9a9767) 76.70%.
Report is 9 commits behind head on main.

Files Patch % Lines
pkg/auth/serviceaccount.go 75.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7417      +/-   ##
==========================================
- Coverage   76.79%   76.70%   -0.09%     
==========================================
  Files         253      253              
  Lines       14098    14169      +71     
==========================================
+ Hits        10826    10868      +42     
- Misses       2732     2749      +17     
- Partials      540      552      +12     

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

@xiangpingjiang xiangpingjiang marked this pull request as ready for review October 31, 2023 02:50
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 31, 2023
@knative-prow knative-prow bot requested review from aliok and aslom October 31, 2023 02:50
@Leo6Leo
Copy link
Member

Leo6Leo commented Oct 31, 2023

/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 Oct 31, 2023
@xiangpingjiang
Copy link
Contributor Author

/retest

@Leo6Leo
Copy link
Member

Leo6Leo commented Nov 13, 2023

Hey @xiangpingjiang, are you blocked on anything? Is this PR ready for review now?

@xiangpingjiang
Copy link
Contributor Author

Hey @xiangpingjiang, are you blocked on anything? Is this PR ready for review now?

hello @Leo6Leo

I think it's ready for rewiew, just the upgrade-tests_eventing_main test sometimes fails, sometimes succeeds. Can I ignore it ?

@Leo6Leo
Copy link
Member

Leo6Leo commented Nov 14, 2023

@xiangpingjiang Sounds good, thanks for the PR! Will take a look at it!

Copy link
Member

@creydr creydr left a comment

Choose a reason for hiding this comment

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

Hello @xiangpingjiang,
thanks for working on this. I left a few comments (mostly about naming)

pkg/auth/serviceaccount.go Outdated Show resolved Hide resolved
pkg/auth/serviceaccount.go Outdated Show resolved Hide resolved
pkg/auth/serviceaccount.go Outdated Show resolved Hide resolved
pkg/auth/serviceaccount.go Outdated Show resolved Hide resolved
Signed-off-by: pingjiang <[email protected]>
@creydr
Copy link
Member

creydr commented Nov 16, 2023

/retest

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.

I really like how this is looking so far!

MarkOIDCIdentityCreatedFailed(reason, messageFormat string, messageA ...interface{})
}

func SetupOIDCServiceAccount(flags feature.Flags, ctx context.Context, serviceAccountLister corev1listers.ServiceAccountLister, kubeclient kubernetes.Interface, gvk schema.GroupVersionKind, objectMeta metav1.ObjectMeta, marker OIDCIdentityStatusMarker, setAuthStatus func(a *duckv1.AuthStatus)) pkgreconciler.Event {
Copy link
Member

Choose a reason for hiding this comment

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

@xiangpingjiang would you be able to add a unit test or two for this function? That way we can catch any breaking changes earlier if this every gets updated

Copy link
Contributor Author

@xiangpingjiang xiangpingjiang Nov 22, 2023

Choose a reason for hiding this comment

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

@Cali0707 I will try to do that. SetupOIDCServiceAccount func rely on EnsureOIDCServiceAccountExistsForResource func, the EnsureOIDCServiceAccountExistsForResource didn't have unit test. Do I need add unit test for EnsureOIDCServiceAccountExistsForResource first ?

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 just SetupOIDCServiceAccount is totally fine, but if you wanted to add tests for both that would be great (just not necessary IMO)

Copy link
Contributor Author

@xiangpingjiang xiangpingjiang Nov 28, 2023

Choose a reason for hiding this comment

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

Hello @Cali0707
I added some unit test, please give me a review when you have time

pkg/auth/serviceaccount.go Outdated Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 21, 2023
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 21, 2023
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.

/lgtm
/cc @creydr

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Nov 28, 2023
Copy link

knative-prow bot commented Nov 28, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Nov 28, 2023
@knative-prow knative-prow bot merged commit 023d618 into knative:main Nov 28, 2023
32 of 34 checks passed
@xiangpingjiang xiangpingjiang deleted the RefactorAuthStatus branch February 3, 2024 10:16
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/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.

Refactor the AuthStatus Logic in Eventing OIDC Feature Track to reduce repetitive code
5 participants