Skip to content
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

[cgroupv2] Add workspace cgroup evacuation #8578

Merged
merged 3 commits into from Mar 3, 2022
Merged

[cgroupv2] Add workspace cgroup evacuation #8578

merged 3 commits into from Mar 3, 2022

Conversation

csweichel
Copy link
Contributor

Description

This PR introduces a cgroup v2 structure in workspaces which lends itself to more rootless workloads within the workspace. For example:

cgroup v2 - new structure - Watch Video

The structure it produces looks as follows:

<container-cgorup>  drwxr-xr-x 3 root root
└── workspace       drwxr-xr-x 5 33333 33333
    └── user        drwxr-xr-x 5 33333 33333

Note that the container-cgroup does not change ownership, but only the child cgroups do. This way, users cannot escape the control imposed by the container runtime.

Related Issue(s)

Fixes #8567

How to test

curl -OL https://github.com/k3s-io/k3s/releases/download/v1.23.4%2Bk3s1/k3s
chmod +x k3s
sudo ./k3s server -d /workspace/data

Release Notes

Support user-modifiable cgroupv2 structure

@codecov
Copy link

codecov bot commented Mar 3, 2022

Codecov Report

Merging #8578 (c1f3d94) into main (ede9db9) will increase coverage by 15.62%.
The diff coverage is 4.76%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #8578       +/-   ##
===========================================
+ Coverage   12.31%   27.94%   +15.62%     
===========================================
  Files          20       85       +65     
  Lines        1161    13874    +12713     
===========================================
+ Hits          143     3877     +3734     
- Misses       1014     9674     +8660     
- Partials        4      323      +319     
Flag Coverage Δ
components-gitpod-cli-app 11.17% <ø> (ø)
components-local-app-app-darwin-amd64 ?
components-local-app-app-darwin-arm64 ?
components-local-app-app-linux-amd64 ?
components-local-app-app-linux-arm64 ?
components-local-app-app-windows-386 ?
components-local-app-app-windows-amd64 ?
components-local-app-app-windows-arm64 ?
components-supervisor-app 35.51% <ø> (?)
components-workspacekit-app 6.86% <6.25%> (?)
components-ws-daemon-api-go-lib ∅ <ø> (?)
components-ws-daemon-app 21.16% <0.00%> (?)
components-ws-daemon-lib 21.16% <0.00%> (?)
components-ws-daemon-nsinsider-app ∅ <ø> (?)
components-ws-manager-app 39.44% <ø> (?)
install-installer-raw-app 4.49% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
components/ws-daemon/pkg/content/hooks.go 0.00% <0.00%> (ø)
components/ws-daemon/pkg/content/service.go 0.00% <0.00%> (ø)
components/ws-daemon/pkg/daemon/daemon.go 0.00% <0.00%> (ø)
components/workspacekit/cmd/rings.go 6.14% <6.25%> (ø)
components/local-app/pkg/auth/auth.go
components/local-app/pkg/auth/pkce.go
components/ws-manager/pkg/manager/create.go 82.95% <0.00%> (ø)
components/workspacekit/cmd/root.go 0.00% <0.00%> (ø)
components/supervisor/pkg/ports/ports.go 59.62% <0.00%> (ø)
components/ws-manager/pkg/manager/probe.go 0.00% <0.00%> (ø)
... and 63 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ede9db9...c1f3d94. Read the comment docs.

@csweichel csweichel marked this pull request as ready for review March 3, 2022 17:36
@csweichel csweichel requested a review from a team March 3, 2022 17:36
@csweichel csweichel requested a review from aledbf as a code owner March 3, 2022 17:36
@csweichel csweichel requested a review from a team March 3, 2022 17:36
@github-actions github-actions bot added team: delivery Issue belongs to the self-hosted team team: workspace Issue belongs to the Workspace team labels Mar 3, 2022
Copy link
Member

@aledbf aledbf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@roboquat roboquat merged commit 4085202 into main Mar 3, 2022
@roboquat roboquat deleted the cw/fix-8567 branch March 3, 2022 22:38
@roboquat roboquat added the deployed: workspace Workspace team change is running in production label Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: workspace Workspace team change is running in production release-note size/XXL team: delivery Issue belongs to the self-hosted team team: workspace Issue belongs to the Workspace team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ws-daemon] Introduce cgroup v2 evacuation function in IWS and use from workspacekit
4 participants