File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -80,3 +80,21 @@ func hasMemorySwapCgroup() bool {
8080 }
8181 return true
8282}
83+
84+ // IsCgroupV2 returns true if the host is using cgroup v2
85+ func IsCgroupV2 () bool {
86+ _ , err := os .Stat ("/sys/fs/cgroup/cgroup.controllers" )
87+ return err == nil
88+ }
89+
90+ // WarnIfCgroupV1 prints a warning if host is using cgroup v1
91+ func WarnIfCgroupV1 () {
92+ if ! IsCgroupV2 () {
93+ klog .Warning (
94+ "Host system is using cgroup v1. " +
95+ "Minikube will not enable cgroup v2. " +
96+ "Some features may not work as expected." ,
97+ )
98+ }
99+ }
100+
Original file line number Diff line number Diff line change @@ -25,3 +25,8 @@ func HasMemoryCgroup() bool {
2525func hasMemorySwapCgroup () bool {
2626 return true
2727}
28+
29+ // WarnIfCgroupV1 is a no-op on non-Linux systems
30+ func WarnIfCgroupV1 () {
31+ // no-op
32+ }
Original file line number Diff line number Diff line change @@ -159,6 +159,10 @@ func CreateContainerNode(p CreateParams) error { //nolint to suppress cyclomatic
159159 return errors .Wrap (err , "daemon info" )
160160 }
161161 }
162+ if runtime .GOOS == "linux" {
163+ WarnIfCgroupV1 ()
164+ }
165+
162166
163167 runArgs := []string {
164168 "-d" , // run the container detached
You can’t perform that action at this time.
0 commit comments