From d550b5a2c4a4cabd157783a9e89d4f7426d10b9d Mon Sep 17 00:00:00 2001 From: nmasse-itix Date: Thu, 23 Dec 2021 18:50:56 +0800 Subject: [PATCH] Improve support for gitea instances not running as root or uid 1000 (#266) ## Context PR #259 introduced support for running Gitea as a uid different than 1000 (git) or 0 (root). ## Problem In init_directory_structure.sh, there is a "chown 1000:1000" on /tmp/gitea. This chown only works when running as root or when the target directory is already owned by uid 1000. As a result, the init container "init-directories" fails on startup when running Gitea with a uid different from 0 or 1000. Initially, I worked around it by implementing an "initPreScript". But it would make user's life easier if we can make it work out-of-the-box. ## Resolution I'm taking model on the chown a few lines above that depends on the value of image.rootless. Since the chown only works on default (root) image and is useless on rootless image, there is no need to run it on rootless image. Co-authored-by: Nicolas MASSE Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/266 Reviewed-by: luhahn Reviewed-by: justusbunsi Co-authored-by: nmasse-itix Co-committed-by: nmasse-itix --- templates/gitea/init.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/gitea/init.yaml b/templates/gitea/init.yaml index 8137d67..5854c7a 100644 --- a/templates/gitea/init.yaml +++ b/templates/gitea/init.yaml @@ -30,7 +30,9 @@ stringData: # prepare temp directory structure mkdir -p "${GITEA_TEMP}" + {{- if not .Values.image.rootless }} chown 1000:1000 "${GITEA_TEMP}" + {{- end }} chmod ug+rwx "${GITEA_TEMP}" configure_gitea.sh: |-