-
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
Ensure /var/log/nginx
is writeable by GID 0
#4269
Conversation
/var/log/nginx
is writeable by 101:0
/var/log/nginx
is writeable by GID 0
44c3692
to
b5784b6
Compare
Hi @sigv can you please open an issue for this PR: https://github.com/nginxinc/kubernetes-ingress/blob/main/CONTRIBUTING.md#open-a-pull-request thanks! |
a304611
to
7ab723f
Compare
Codecov Report
@@ Coverage Diff @@
## main #4269 +/- ##
==========================================
- Coverage 52.00% 51.99% -0.02%
==========================================
Files 59 59
Lines 16960 16960
==========================================
- Hits 8820 8818 -2
- Misses 7845 7847 +2
Partials 295 295 see 1 file with indirect coverage changes 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
d640e6c
to
6b93eec
Compare
083732d
to
13219c8
Compare
9ef13ec
to
e98cc72
Compare
30030e0
to
78bce8d
Compare
21edb11
to
0d31e25
Compare
10834df
to
fe561c6
Compare
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.
Sorry for the long wait again @sigv
I guess it doesn't cost us anything to set the permissions for /var/log/nginx
and be on the safe side.
No worries! I fully understand things sometimes take time 🙂 0c8462d shuffled lines around and there's now a merge conflict to resolve. |
Tests are failing as they want to re-build the Nginx Plus components for which my repo doesn't have the certificate. 😞 |
a1d5c86
to
dfd1f02
Compare
In a standard deployment, error log is written to `/dev/stderr` and access log is written to `/dev/stdout`. Furthermore, `error.log` and `access.log` in `/var/log/nginx` are mapped to the respective stdio. However, a deployment may override configuration, and remove the symbolic links, to write to the container storage directly. OpenShift tries to impose various restrictions by default. One of these is for UID/GID used by the container process. If these restrictions are supported in future, adjustments to file system permissions need to be done so that /var/log/nginx remains writeable. Specifically, OpenShift adds GID 0 as supplemental to container process for file system operations. This PR ensures the nginx user (UID `101`) and root group (GID `0`) owns the log directory, and that owner group permissions match the owner user permissions (`g=u`). This ensures that OpenShift deployments retain write permissions in future.
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.
Thanks again for being patient with us @sigv !
I'm not sure how the Alpine error could be triggered by this change ( |
@sigv That particular log message happens when we're enumerating pods before they are ready. From the logs its looks like the pods for that test took too long to become ready. |
@sigv I've re-run the failed test and everything is green now. Just waiting on images to be built and we should be good 😄 |
🚀 |
Proposed changes
In a standard deployment, error log is written to
/dev/stderr
and access log is written to/dev/stdout
. Furthermore,error.log
andaccess.log
in/var/log/nginx
are mapped to the respective stdio. However, a deployment may override configuration, and remove the symbolic links, to write to the container storage directly.OpenShift tries to impose various restrictions by default. One of these is for UID/GID used by the container process. If these restrictions are supported in future, adjustments to file system permissions need to be done so that /var/log/nginx remains writeable. Specifically, OpenShift adds GID 0 as supplemental to container process for file system operations.
This PR ensures the nginx user (UID
101
) and root group (GID0
) owns the log directory, and that owner group permissions match the owner user permissions (g=u
). This ensures that OpenShift deployments retain write permissions in future.This permissions change was already being applied to App Protect builds, where I presume writing to disk is enabled by default. Now with the PR, the permissions are ensured for all customers (not only App Protect variant).
Closes #4279.
Checklist
Before creating a PR, run through this checklist and mark each as complete.