Skip to content

Commit 3b0e92b

Browse files
author
utam0k
committed
ws-daemon: Align cgroupv2 decisions with others
1 parent c98eb0f commit 3b0e92b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

components/ws-daemon/pkg/daemon/daemon.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"k8s.io/client-go/rest"
1818
"k8s.io/client-go/tools/clientcmd"
1919

20+
"github.com/gitpod-io/gitpod/common-go/cgroups"
2021
"github.com/gitpod-io/gitpod/common-go/log"
2122
"github.com/gitpod-io/gitpod/ws-daemon/api"
2223
"github.com/gitpod-io/gitpod/ws-daemon/pkg/container"
@@ -58,7 +59,12 @@ func NewDaemon(config Config, reg prometheus.Registerer) (*Daemon, error) {
5859
cgCustomizer,
5960
markUnmountFallback,
6061
}
61-
if _, err := os.Stat("/sys/fs/cgroup/cgroup.controllers"); os.IsNotExist(err) {
62+
63+
unified, err := cgroups.IsUnifiedCgroupSetup()
64+
if err != nil {
65+
return nil, xerrors.Errorf("could not determine cgroup setup: %w", err)
66+
}
67+
if unified {
6268
listener = append(listener, CacheReclaim(config.Resources.CGroupBasePath))
6369
}
6470

0 commit comments

Comments
 (0)