Skip to content

Authenticate requests from PingSources#7525

Merged
knative-prow[bot] merged 30 commits intoknative:mainfrom
Zazzscoot:main
Jan 18, 2024
Merged

Authenticate requests from PingSources#7525
knative-prow[bot] merged 30 commits intoknative:mainfrom
Zazzscoot:main

Conversation

@Zazzscoot
Copy link
Contributor

@Zazzscoot Zazzscoot commented Dec 25, 2023

Fixes #7320

Proposed Changes

(Prerequisites: OIDC mode is enabled, and sink has a defined audience)

  • Binds the source's service account to allow the source to create a JWT token
  • Edited existing tests to add sinkAudience

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


Docs

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 25, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@knative-prow
Copy link

knative-prow bot commented Dec 25, 2023

Welcome @Zazzscoot! It looks like this is your first PR to knative/eventing 🎉

@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 25, 2023
@knative-prow
Copy link

knative-prow bot commented Dec 25, 2023

Hi @Zazzscoot. 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.

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.

@creydr
Copy link
Member

creydr commented Dec 27, 2023

Hello @Zazzscoot,
Thanks for your work on this so far. I just got roughly over your PR and saw you want to create some roles & rolebindings dynamically. This is not needed in case of the pingsource, as we have only one pingsource managing pod running (in the knative-eventing namespace) which handles all pingsource resources (not like in case of the apiserversource, which creates a deployment for each apiserversource resource). So you need only to adjust the permissions of the pingsource deployment/pod (pingsource-mt-adapter-clusterrole.yaml)

@Leo6Leo
Copy link
Member

Leo6Leo commented Jan 2, 2024

@Zazzscoot Thanks for the PR! Here are some review comments I have:

  1. As this is your very first PR in the LFX(linux fundation) community, please make sure you complete the EasyCLA so that you are authorized to contribute to Knative.

Here is the link on what is EasyCLA and how to complete it.

  1. And for the description of the PR, make sure you put the issue number and the keyword "fixes" on the same line, as GitHub will automatically detect it and link the issue and your PR together.

image
image

  1. For the PRs that you are still working on, you can add a keyword "[WIP]" at the beginning of the title of your PR.
    For example, your PR's title is Authenticate requests from PingSources, you can edit it and make it become [WIP] Authenticate requests from PingSources ", and the bot will automatically add a label to it and indicate that this PR is work in progress. And you can also open this PR as a draft PR.

@Leo6Leo
Copy link
Member

Leo6Leo commented Jan 3, 2024

@Zazzscoot I made some graphics and hope to assist your understanding of the whole workflow!

image

image

On how to approach solving this issue, as suggested in my graphic:

  1. Granting the access
    According to @creydr 's comment, we need to grant permission to PingSource's adaptor, so it can create the JWT token (OIDC Token)! Take a look at my PR here and it will help!

  2. Testing it is actually working
    Take a look at here and ApiserversourceSendEventWithJWT() function on how to make a e2e test on this and how to make reconciler test here

Tips:

  1. You might be encountering the trouble when you are copying the lines similar to these
    https://github.com/knative/eventing/pull/7452/files#diff-d2cf61e462d4d61f80a631d9fc5f72ffd47999876b91b472e7d3af5ea700f7e5R63-R64
    And your IDE will complain about it by saying "file not found" or something similar. Don't worry, you may just need to update the dependency! Simply runing hack/update-deps.sh will simply solve the problem by adding a few new files in the vendor folder.

Please let me know if you have any other questions or need further explainations!

@Zazzscoot Zazzscoot changed the title Authenticate requests from PingSources [WIP] Authenticate requests from PingSources Jan 5, 2024
@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 Jan 5, 2024
@Zazzscoot Zazzscoot marked this pull request as draft January 5, 2024 03:33
@creydr
Copy link
Member

creydr commented Jan 8, 2024

Hi @Zazzscoot,
the 1.13 release is in ~ 2 weeks (Jan 24th). Do you think we can complete this by that date (including the reviews) as we would like to see this in? How can I help you?

@knative-prow knative-prow bot added the area/test-and-release Test infrastructure, tests or release label Jan 8, 2024
@knative-prow knative-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 8, 2024
@Zazzscoot Zazzscoot marked this pull request as ready for review January 8, 2024 17:59
@Zazzscoot
Copy link
Contributor Author

/cc @Leo6Leo @creydr

@Leo6Leo
Copy link
Member

Leo6Leo commented Jan 8, 2024

/ok-to-test

@knative-prow knative-prow bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jan 8, 2024
@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 Jan 17, 2024
@Zazzscoot
Copy link
Contributor Author

/ok-to-test

@Zazzscoot Zazzscoot requested a review from Leo6Leo January 17, 2024 09:17
@creydr
Copy link
Member

creydr commented Jan 17, 2024

/ok-to-test

Hi @Zazzscoot,
to run the Github workflows, an org member has to approve them manually (on PRs from non-org members). The /ok-to-test label can only be applied once and tells Prow to run these tests

@Zazzscoot
Copy link
Contributor Author

Please see my review comments. After that, your errors should be fixed. Please let me know if you have any other questions! @Zazzscoot

Hey @Leo6Leo, I have made your changes and the TestPingSourceSendsEventsWithOIDC is now passing! Thank you so much for the comment!

@Zazzscoot
Copy link
Contributor Author

/ok-to-test

Hi @Zazzscoot, to run the Github workflows, an org member has to approve them manually (on PRs from non-org members). The /ok-to-test label can only be applied once and tells Prow to run these tests

Noted, thanks for the clarification!

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.

Only one tiny comment. Otherwise looking good!
Thanks for your work so far @Zazzscoot and @yijie-04 👍

@creydr
Copy link
Member

creydr commented Jan 17, 2024

And it seems to have a couple of style issues too. Could you PTAL at them?

@creydr
Copy link
Member

creydr commented Jan 17, 2024

/retest

@creydr
Copy link
Member

creydr commented Jan 18, 2024

/retest

1 similar comment
@creydr
Copy link
Member

creydr commented Jan 18, 2024

/retest

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.

Only one unneeded/leftover comment to be removed

@Zazzscoot Zazzscoot requested a review from creydr January 18, 2024 14:45
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.

Thanks a lot @Zazzscoot and @yijie-04 for you work and patience for finishing it!
🎉 🎉 🎉

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jan 18, 2024
@knative-prow
Copy link

knative-prow bot commented Jan 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 18, 2024
@knative-prow knative-prow bot merged commit fb9be2b into knative:main Jan 18, 2024
@Leo6Leo
Copy link
Member

Leo6Leo commented Jan 18, 2024

@Zazzscoot @yijie-04 Great work guys! You guys did it! Hope to see more contributions from you in the knative community :)

@yijie-04
Copy link
Contributor

Thank you so much for the help and support! @Leo6Leo @creydr

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 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.

Authenticate Requests from PingSources

6 participants