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

✨ auth: use synthetic user/group when service account is not defined #1816

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

joelanford
Copy link
Member

@joelanford joelanford commented Feb 26, 2025

Description

Today at a meeting among maintainers of OLMv1, we discussed an idea that @thetechnick proposed awhile back. That is: stop using service accounts and service account tokens. Instead use synthetic names with impersonation.

While we are now 1.0.0 with support for service accounts, we can deprecate that feature and recommend attaching permissions to synthetic users/groups instead.

This PR demonstrates how we might do this. But with the API change, we should write up a detailed design and gain consensus.

This PR uses:

  • User: "olm:clusterextensions:<clusterExtensionName>"
  • Groups: ["olm:clusterextensions", "system:authenticated"] (not sure we need to be explicit about system:authenticated, but it can't hurt)

asciicast

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 26, 2025
Copy link

netlify bot commented Feb 26, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 9904073
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/67dd617cf78b820008d88ed7
😎 Deploy Preview https://deploy-preview-1816--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@joelanford joelanford force-pushed the synthetic-permissions branch 3 times, most recently from dfc5ccb to fbcc4a5 Compare February 26, 2025 22:35
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 68.99%. Comparing base (fc88b93) to head (9904073).

Files with missing lines Patch % Lines
internal/operator-controller/action/restconfig.go 69.56% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1816   +/-   ##
=======================================
  Coverage   68.98%   68.99%           
=======================================
  Files          66       67    +1     
  Lines        5243     5276   +33     
=======================================
+ Hits         3617     3640   +23     
- Misses       1395     1403    +8     
- Partials      231      233    +2     
Flag Coverage Δ
e2e 50.27% <40.00%> (-0.27%) ⬇️
unit 56.72% <54.28%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joelanford joelanford force-pushed the synthetic-permissions branch 3 times, most recently from 11210fc to e44c4d2 Compare February 27, 2025 05:06
@thetechnick
Copy link
Contributor

I'd like to have a discussion on the olmv1 prefix vs just olm and the :admin suffix before this gets merged, but otherwise this looks pretty much how I'd wanted it to look. Thanks for the work!

@perdasilva perdasilva force-pushed the synthetic-permissions branch 2 times, most recently from 1c2f38f to 73e6080 Compare February 27, 2025 12:29
@joelanford
Copy link
Member Author

I'd like to have a discussion on the olmv1 prefix vs just olm and the :admin suffix before this gets merged, but otherwise this looks pretty much how I'd wanted it to look. Thanks for the work!

I put next to no critical thought into the name and group names. @thetechnick you propose the following?

  • User: olm:clusterextensions:<ceName>
  • Group:olm:clusterextensions (and still keep system:authenticated)

@perdasilva perdasilva force-pushed the synthetic-permissions branch from 73e6080 to fb13084 Compare February 27, 2025 13:51
@thetechnick
Copy link
Contributor

@joelanford precisely. 👍

@perdasilva perdasilva force-pushed the synthetic-permissions branch 7 times, most recently from 59b818a to c9575d3 Compare March 5, 2025 10:38
@perdasilva perdasilva force-pushed the synthetic-permissions branch from c9575d3 to 76ca00e Compare March 5, 2025 13:53
@perdasilva perdasilva marked this pull request as ready for review March 6, 2025 08:53
@perdasilva perdasilva requested a review from a team as a code owner March 6, 2025 08:53
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 6, 2025
@perdasilva perdasilva force-pushed the synthetic-permissions branch 3 times, most recently from cd6d528 to 7546680 Compare March 10, 2025 15:10
@perdasilva perdasilva force-pushed the synthetic-permissions branch 2 times, most recently from 279322a to 48cb945 Compare March 17, 2025 09:45
}
}

func ClusterExtensionUserRestConfigMapper(tokenGetter *authentication.TokenGetter) func(ctx context.Context, o client.Object, c *rest.Config) (*rest.Config, error) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Should we pass a enableSyntheticUserAuthentication function parameter so that we can reference the feature gate only in main.go?

Copy link
Contributor

@perdasilva perdasilva Mar 21, 2025

Choose a reason for hiding this comment

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

is that a general goal that we have that FGs should only be referenced in main? I might need to update the Single-OwnNamespace FG if that's the case. My only worry about it is that if it's only checked somewhere down the stack, we end up having to thread it all the way down, which could be painful. What is the value of having it in main? In the end I end up searching the code for usages of the FG anyway. Is it helpful in other contexts as well?

joelanford and others added 12 commits March 21, 2025 13:54
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
@perdasilva perdasilva force-pushed the synthetic-permissions branch from 48cb945 to 9904073 Compare March 21, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants