Skip to content

Commit

Permalink
Use runc's cgroup v2 determination
Browse files Browse the repository at this point in the history
It is runc that has done the most development in this area and will be supported the fastest. Also, k8s uses this decision too.
  • Loading branch information
utam0k committed Mar 7, 2022
1 parent d34a781 commit fe9e4fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/ws-daemon/pkg/iws/iws.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"syscall"
"time"

"github.com/containerd/cgroups"
"github.com/opentracing/opentracing-go"
"golang.org/x/sys/unix"
"golang.org/x/time/rate"
Expand All @@ -34,6 +33,7 @@ import (
"github.com/gitpod-io/gitpod/ws-daemon/api"
"github.com/gitpod-io/gitpod/ws-daemon/pkg/container"
"github.com/gitpod-io/gitpod/ws-daemon/pkg/internal/session"
libcontainercgroups "github.com/opencontainers/runc/libcontainer/cgroups"
)

//
Expand Down Expand Up @@ -287,7 +287,7 @@ func (wbs *InWorkspaceServiceServer) PrepareForUserNS(ctx context.Context, req *
return nil, status.Errorf(codes.Internal, "cannot mount shiftfs mark")
}

if cgroups.Mode() == cgroups.Unified {
if libcontainercgroups.IsCgroup2UnifiedMode() {
cgroupBase, err := rt.ContainerCGroupPath(ctx, wscontainerID)
if err != nil {
log.WithError(err).WithFields(wbs.Session.OWI()).Error("cannot find workspace container CGroup path")
Expand Down Expand Up @@ -824,7 +824,7 @@ func (wbs *InWorkspaceServiceServer) WriteIDMapping(ctx context.Context, req *ap
// └── workspace drwxr-xr-x 5 gitpodUid gitpodGid
// └── user drwxr-xr-x 5 gitpodUid gitpodGid
func (wbs *InWorkspaceServiceServer) EvacuateCGroup(ctx context.Context, req *api.EvacuateCGroupRequest) (*api.EvacuateCGroupResponse, error) {
if cgroups.Mode() != cgroups.Unified {
if !libcontainercgroups.IsCgroup2UnifiedMode() {
return &api.EvacuateCGroupResponse{}, nil
}

Expand Down

0 comments on commit fe9e4fa

Please sign in to comment.