-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Apply UID/GID defaults from image #3665
base: main
Are you sure you want to change the base?
Conversation
e9847eb
to
9a78b51
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3665 +/- ##
==========================================
+ Coverage 52.32% 52.35% +0.03%
==========================================
Files 61 59 -2
Lines 17502 16880 -622
==========================================
- Hits 9158 8838 -320
+ Misses 8015 7747 -268
+ Partials 329 295 -34 ☔ View full report in Codecov by Sentry. |
a3a1fc0
to
f38706e
Compare
Not sure if CI / Smoke Tests (alpine, policies, 1.26.2) failure of internally observed 502 Bad Gateway response is relevant to this PR. 🤔
|
ab538f7
to
67a9b99
Compare
b975e9b
to
5344586
Compare
f4b93df
to
d407700
Compare
11dc22e
to
c9a02e5
Compare
690f861
to
cec777a
Compare
Hi @sigv can you create a new issue for this as the one linked in description seems incomplete and WIP, we can then prioritise and review the PR, thanks! |
f3b7352
to
f291fb8
Compare
`build/Dockerfile` specifies `USER 101` for `common` target, which is re-applied into the final images. Helm Chart/Manifests do not need to specify UID explicitly, and can instead use the image's UID. (PodSecurityContext v1 core specifies `runAsUser` defaults to user specified in image metadata if unspecified.) The existing `runAsNonRoot: true` flag (already in place) will ensure during runtime that the image is configured with a custom user ID. This is notably helpful for users running OpenShift, because OpenShift attempts to enforce custom UID/GID ranges for individual namespaces as part of `restricted-v2` Security Context Constraint. When removing hard-coded values from manifests, OpenShift will be able to assign its own UID/GID. In practice, this means a different model of configuring file system permissions. OpenShift assigns the container process GID 0 as supplemental to assist with that. Locations that are expected to be written to must be owned by GID 0, with group write permissions. Previous changes to `main` have ensured that is the case. Init container copying files is not a concern, as we will have the same UID as owner there as the main NIC container. Reference: https://cloud.redhat.com/blog/a-guide-to-openshift-and-uids
This PR is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
Hi @sigv, now that securityContext is configurably using helm, is this still required? |
This PR is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
Proposed changes
build/Dockerfile
specifiesUSER 101
forcommon
target, which is re-applied into the final images. Helm Chart/Manifests do not need to specify UID explicitly, and can instead use the image's UID. (PodSecurityContext v1 core specifiesrunAsUser
defaults to user specified in image metadata if unspecified.)The existing
runAsNonRoot: true
flag (already in place) will ensure during runtime that the image is configured with a custom user ID.This is notably helpful for users running OpenShift, because OpenShift attempts to enforce custom UID/GID ranges for individual namespaces as part of
restricted-v2
Security Context Constraint. When removing hard-coded values from manifests, OpenShift will be able to assign its own UID/GID.In practice, this means a different model of configuring file system permissions. OpenShift assigns the container process GID 0 as supplemental to assist with that. Locations that are expected to be written to must be owned by GID 0, with group write permissions. Previous changes to
main
have ensured that is the case.Init container copying files is not a concern, as we will have the same UID as owner there as the main NIC container.
Reference: A Guide to OpenShift and UIDs
Closes #5422.
Checklist
Before creating a PR, run through this checklist and mark each as complete.