Fix rootless image usage with enhanced security-context #160
Reference in New Issue
Block a user
No description provided.
Delete Branch "refs/pull/160/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I've noticed that the commented
securityContext
is not really useable with the rootless image due to different directory structure compared to the default image.Important for the
readOnlyRootFilesystem
is to declare theTMPDIR
environment variable, so that the tmp directory (which is readonly in this case) won't be used. Instead, another writeable directory can be used.Another thing is the explicit hint that all these security options cannot be used with the default (root-based) image, because of its design.
Although this PR would fix the referenced issue, I am not totally happy with the current implementation. It would be more straight forward to use the same mount points for both image variants. Unfortunately, this is not possible right now due to hard coded paths in the default (root) image startup scripts.Anyone have suggestions on how this could be more simple?Sum-up:
As mentioned in Discord, this PR tried to make too many changes. The necessary changes made in 1f331a7e6577fc798196a84a957330aca0d663cd will fix an error that occurs due to restricted access to the
/tmp
directory in a rootless image with all thesecurityContext
options enabled.I also updated the default image to 1.14.2.
Fixes: #158
Thanks for the PR.
Will look at your changes this week.
Maybe I found a solution for my mentioned worries regarding the current fix. But it includes a patch for the rootful docker image in the Gitea project. Currently, this root based image has hard coded
/data
references in its setup scripts and templates. Making this part of the image configurable during runtime by setting theGITEA_WORK_DIR
environment variable inside the image to/data
allows us to handle both image variants the same way in this helm chart.I am currently working on these modifications in Gitea and provide a PR; it's useful anyway to allow such configuration ?. After it's merged, my suggested changes for this helm chart will be less complex since both images can use the same paths configured from inside the chart.
What do you say @luhahn? Shall we wait for the necessary modification in Gitea before making any further actions in this PR?
EDIT: Without having it tested yet, this is how this PR could be simplified.
sorry again, our cluster had some major issues, which caused me to have no time at all. I will try to get back to you this week!
Hi, I finally got some time to spend on gitea :)
I've got some questions regarding your PR.
sorry, should've read your explanation before :D
Looks good to me, tested on my cluster
@justusbunsi please "update branch" se we can merge it
@6543 Done.