Skip to content

ROX-25912: Make Kube SA token m2m auth config dynamic#12969

Merged
kylape merged 3 commits intomasterfrom
klape/kube-sa-token-m2m
Apr 2, 2025
Merged

ROX-25912: Make Kube SA token m2m auth config dynamic#12969
kylape merged 3 commits intomasterfrom
klape/kube-sa-token-m2m

Conversation

@kylape
Copy link
Contributor

@kylape kylape commented Oct 9, 2024

The kube SA token m2m auth config that exists now is added for policy as code and hard codes a role mapping to the config-controller service account. This effectively locks out any other user from using the m2m config for any other purpose. This change tries to allow users to configure the Kube SA token m2m auth config while the required role mapping for policy-as-code remains intact.

@kylape kylape requested a review from a team as a code owner October 9, 2024 22:16
@janisz janisz removed the request for review from a team January 17, 2025 11:21
@kylape kylape force-pushed the klape/kube-sa-token-m2m branch from c1ec149 to 8111e71 Compare March 14, 2025 20:44
@kylape kylape requested a review from a team as a code owner March 14, 2025 20:44
@kylape kylape marked this pull request as draft March 14, 2025 20:44
@kylape kylape requested review from ajheflin and clickboo March 14, 2025 20:44
@rhacs-bot
Copy link
Contributor

rhacs-bot commented Mar 14, 2025

Images are ready for the commit at 6bbda75.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.8.x-332-g6bbda75195.

@kylape kylape force-pushed the klape/kube-sa-token-m2m branch from 8111e71 to 1702a24 Compare March 27, 2025 03:38
@kylape kylape changed the title WIP: Make Kube SA token m2m auth config dynamic ROX-25912: Make Kube SA token m2m auth config dynamic Mar 27, 2025
@kylape kylape marked this pull request as ready for review March 27, 2025 03:41
@codecov
Copy link

codecov bot commented Mar 27, 2025

Codecov Report

Attention: Patch coverage is 81.63265% with 9 lines in your changes missing coverage. Please review.

Project coverage is 48.89%. Comparing base (35b99d8) to head (6bbda75).
Report is 37 commits behind head on master.

Files with missing lines Patch % Lines
central/auth/datastore/datastore_impl.go 81.63% 6 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #12969   +/-   ##
=======================================
  Coverage   48.89%   48.89%           
=======================================
  Files        2547     2547           
  Lines      186992   186896   -96     
=======================================
- Hits        91426    91386   -40     
+ Misses      88324    88275   -49     
+ Partials     7242     7235    -7     
Flag Coverage Δ
go-unit-tests 48.89% <81.63%> (+<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:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This allows customers to add their own role mappings for this config. If a customer breaks config-controller auth, they can simply restart Central to get it back to a working state.

Adds a function configureConfigControllerAccess to the initialization of the token exchangers that ensures the config-controller has access to Central APIs via k8s service account token m2m auth.

What this function does in plain english:

* See if any existing m2m configs from the db are for the kube sa issuer
* If yes, make sure the role mapping for config-controller is present
* If no, create a new m2m config for kube sa issuer like we do today and save it to the db
@kylape kylape force-pushed the klape/kube-sa-token-m2m branch from 1702a24 to dfc508e Compare March 27, 2025 13:19
@kylape
Copy link
Contributor Author

kylape commented Mar 28, 2025

/test gke-upgrade-tests

Copy link
Contributor

@clickboo clickboo left a comment

Choose a reason for hiding this comment

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

minor nits, looks good otherwise

@kylape
Copy link
Contributor Author

kylape commented Mar 31, 2025

/test ocp-4-12-nongroovy-e2e-tests

@kylape kylape merged commit 4fa9deb into master Apr 2, 2025
89 checks passed
@kylape kylape deleted the klape/kube-sa-token-m2m branch April 2, 2025 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants