kubelet: skip setting the devices cgroup

use the new libcontainer feature of skipping setting the devices
cgroup.  This is necessary on cgroup v2 to avoid leaking a eBPF
program every time the cgroup is re-configured.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2020-07-07 08:56:15 +02:00
parent c655a5b636
commit 0d2a493a8f
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED
3 changed files with 6 additions and 2 deletions

View File

@ -495,6 +495,7 @@ func setResourcesV2(cgroupConfig *libcontainerconfigs.Cgroup) error {
Major: libcontainerconfigs.Wildcard,
},
}
cgroupConfig.Resources.SkipDevices = true
manager, err := cgroupfs2.NewManager(cgroupConfig, cgroupConfig.Path, false)
if err != nil {
@ -517,6 +518,7 @@ func (m *cgroupManagerImpl) toResources(resourceConfig *ResourceConfig) *libcont
Major: libcontainerconfigs.Wildcard,
},
},
SkipDevices: true,
}
if resourceConfig == nil {
return resources

View File

@ -384,6 +384,7 @@ func createManager(containerName string) (cgroups.Manager, error) {
Major: configs.Wildcard,
},
},
SkipDevices: true,
},
}

View File

@ -125,6 +125,7 @@ func createCgroupManager(name string) (cgroups.Manager, error) {
Resources: &configs.Resources{
Memory: int64(memoryLimit),
MemorySwap: -1,
SkipDevices: true,
Devices: []*configs.DeviceRule{
{
Minor: configs.Wildcard,