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

Fix: Sanitize user identity before injecting into task pod as K8s label #5023

Merged
merged 2 commits into from
Mar 8, 2024

Conversation

fg91
Copy link
Member

@fg91 fg91 commented Mar 8, 2024

Why are the changes needed?

@ByronHsu recently implemented middleware to inject the user identity into the flyte workflow's ExecutionSpec: flyteorg/flyteadmin#549 and in #4637 I injected the user identity into task pods as a label.

For IdPs like Okta, the execution identity is an email address which is not a valid Kubernetes label, causing the creation of the pod to fail.

What changes were proposed in this pull request?

In this PR I add sanitation to the execution identity before injecting it as a label.

How was this patch tested?

  • Ran flytepropeller with this change and ensured that pods can be created when the execution identity is an email address
  • Added a unit test that would have caught this
  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Copy link

codecov bot commented Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.51%. Comparing base (992641c) to head (343c46c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5023      +/-   ##
==========================================
- Coverage   58.99%   58.51%   -0.49%     
==========================================
  Files         645      567      -78     
  Lines       55547    50933    -4614     
==========================================
- Hits        32772    29802    -2970     
+ Misses      20183    18720    -1463     
+ Partials     2592     2411     -181     
Flag Coverage Δ
unittests 58.51% <100.00%> (-0.49%) ⬇️

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.

@fg91 fg91 self-assigned this Mar 8, 2024
@fg91 fg91 added the bug Something isn't working label Mar 8, 2024
@fg91 fg91 marked this pull request as ready for review March 8, 2024 10:53
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 8, 2024
Signed-off-by: Fabio Graetz <[email protected]>
@fg91 fg91 requested review from eapolinario, kumare3 and hamersaw March 8, 2024 11:04
@davidmirror-ops davidmirror-ops requested a review from EngHabu March 8, 2024 15:43
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 8, 2024
@eapolinario eapolinario merged commit f52164d into master Mar 8, 2024
48 of 49 checks passed
@eapolinario eapolinario deleted the fg91/fix/user-identity-label-sanitation branch March 8, 2024 18:22
yubofredwang pushed a commit to yubofredwang/flyte that referenced this pull request Mar 26, 2024
…el (flyteorg#5023)

* Fix: Sanitize user identity before injecting into task pod as K8s label

Signed-off-by: Fabio Graetz <[email protected]>

* Lint

Signed-off-by: Fabio Graetz <[email protected]>

---------

Signed-off-by: Fabio Graetz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants