-
Notifications
You must be signed in to change notification settings - Fork 346
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
Don't hardcode root when running lifecycle scripts #1317
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.
Had a remark about error handling, other than that LGTM. Thanks for the contribution 🙌
@nrontsis thanks for the contribution! The implementation is a small change with a big impact, perfect! If you have some time I would love to know an full e2e test was run, even manually, just to ensure the workspace starts with no errors and that it doesn't cause other issues. Once this is done and the 2 small remarks we can merge |
@bkneis I've now successfully tested the minimal example end-to-end using the following steps. First go to my test repo, build Then clone the patched
where kind: Pod
apiVersion: v1
spec:
initContainers:
- name: set-volume-owner
image: busybox
command: [ "sh", "-c", "chown -R 1000:1000 /volume" ]
volumeMounts:
- mountPath: /volume
name: devpod
subPath: devpod/0
containers:
- name: devpod
securityContext:
runAsGroup: 1000
runAsUser: 1000
runAsNonRoot: true
status: {} which runs without issues. |
I believe this is ready now. |
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 for the contribution! LGTM
Thanks for the reviews! Happy to merge this? |
As discussed in #1313 (comment), this PR avoids a hardcoded assumption from the lifecycle scripts that the devpod is built under a root user.
Building the devpod under a non-root user can be important in restricted kubernetes corporate environments. While currently creating devpods under a non-root user in kubernetes requires some further hacks, this PR removes a blocking certain aspect of it, allowing for creating a devpod as per the following demo. Before this PR, the building of the devpod would stop because
"su", user, "-c", command.Quote(c)
would be called by the run lifecycle hooks logicMinimal example (not tested end-to-end)
where
k8s_template.yaml
is