-
Notifications
You must be signed in to change notification settings - Fork 263
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
Populate container.SecurityContext.RunAsUser when --user flag is used #1927
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vyasgun: 0 warnings.
In response to this:
Description
Changes
- Setting container's RunAsUser field based on the
--user
flag at the end so it does not reinitialize the security contextReference
Fixes #1926
Release Note
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.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1927 +/- ##
==========================================
+ Coverage 74.58% 76.83% +2.25%
==========================================
Files 207 207
Lines 15563 12753 -2810
==========================================
- Hits 11607 9799 -1808
+ Misses 3167 2165 -1002
Partials 789 789 ☔ View full report in Codecov by Sentry. |
if flags.Changed("user") { | ||
err = UpdateUser(podSpec, p.User) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to change the order of evaluation here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it's very likely SC was override by UpdateSecurityContext
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of evaluation is causing the value of the user flag to get overwritten. I have created an issue for this: #1926
It would be nice to have a simple unit tests for the change. |
@vyasgun gentle ping. If you could check my comments, pls. I'd like to make sure both |
Thanks for the review, @dsimansk! Updated the PR with a small change which will test both flags together. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dsimansk, vyasgun 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 |
/retest |
@vyasgun I still have a small hesitation how to fix the issue actually. Maybe the |
Description
Changes
--user
flag at the end so it does not reinitialize the security contextReference
Fixes #1926
Release Note