From daada5e85005d89c4e03439d1619978254cae076 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 18 Jun 2025 09:44:29 -0700 Subject: [PATCH 1/3] libct/configs: add package docstring Signed-off-by: Kir Kolyshkin (cherry picked from commit a10d338eb2ce83b1753bc5e961766588accedc36) Signed-off-by: Kir Kolyshkin --- libcontainer/configs/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libcontainer/configs/config.go b/libcontainer/configs/config.go index e21971554..fca95ee58 100644 --- a/libcontainer/configs/config.go +++ b/libcontainer/configs/config.go @@ -1,3 +1,5 @@ +// Package configs provides various container-related configuration types +// used by libcontainer. package configs import ( From af614c94bd67dcc4346df67f7df5cec3b3fcac0b Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 17 Jun 2025 15:30:04 -0700 Subject: [PATCH 2/3] libct/configs: fix/improve deprecation notices The per-file deprecation in cgroup_deprecated.go is not working, let's replace it. Link to Hooks.Run in Hook.Run deprecation notice. Signed-off-by: Kir Kolyshkin (cherry picked from commit b25bcaa8b39d33f46e032e8d980d57358b40d2bd) Signed-off-by: Kir Kolyshkin --- libcontainer/configs/cgroup_deprecated.go | 5 ++++- libcontainer/configs/config.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libcontainer/configs/cgroup_deprecated.go b/libcontainer/configs/cgroup_deprecated.go index 9a7a1a201..7836b240a 100644 --- a/libcontainer/configs/cgroup_deprecated.go +++ b/libcontainer/configs/cgroup_deprecated.go @@ -1,7 +1,8 @@ -package configs // Deprecated: use [github.com/opencontainers/cgroups]. +package configs import "github.com/opencontainers/cgroups" +// Deprecated: use [github.com/opencontainers/cgroups]. type ( Cgroup = cgroups.Cgroup Resources = cgroups.Resources @@ -14,12 +15,14 @@ type ( IfPrioMap = cgroups.IfPrioMap ) +// Deprecated: use [github.com/opencontainers/cgroups]. const ( Undefined = cgroups.Undefined Frozen = cgroups.Frozen Thawed = cgroups.Thawed ) +// Deprecated: use [github.com/opencontainers/cgroups]. var ( NewWeightDevice = cgroups.NewWeightDevice NewThrottleDevice = cgroups.NewThrottleDevice diff --git a/libcontainer/configs/config.go b/libcontainer/configs/config.go index fca95ee58..92773aceb 100644 --- a/libcontainer/configs/config.go +++ b/libcontainer/configs/config.go @@ -458,7 +458,7 @@ type Capabilities struct { Ambient []string } -// Deprecated: use (Hooks).Run instead. +// Deprecated: use [Hooks.Run] instead. func (hooks HookList) RunHooks(state *specs.State) error { for i, h := range hooks { if err := h.Run(state); err != nil { From 15dc7b516e7c7e9c111298978d333350d7f11bba Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 17 Jun 2025 15:35:29 -0700 Subject: [PATCH 3/3] libct/configs: stop using deprecated id Signed-off-by: Kir Kolyshkin (cherry picked from commit d22a42113dc01c0e0ee19a8073f784ca83f1a8af) Signed-off-by: Kir Kolyshkin --- libcontainer/configs/config.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libcontainer/configs/config.go b/libcontainer/configs/config.go index 92773aceb..3869a2edc 100644 --- a/libcontainer/configs/config.go +++ b/libcontainer/configs/config.go @@ -16,6 +16,7 @@ import ( "github.com/sirupsen/logrus" "golang.org/x/sys/unix" + "github.com/opencontainers/cgroups" devices "github.com/opencontainers/cgroups/devices/config" "github.com/opencontainers/runtime-spec/specs-go" ) @@ -144,8 +145,8 @@ type Config struct { Routes []*Route `json:"routes"` // Cgroups specifies specific cgroup settings for the various subsystems that the container is - // placed into to limit the resources the container has available - Cgroups *Cgroup `json:"cgroups"` + // placed into to limit the resources the container has available. + Cgroups *cgroups.Cgroup `json:"cgroups"` // AppArmorProfile specifies the profile to apply to the process running in the container and is // change at the time the process is execed