Use github.com/containerd/cgroups/v3 to remove gogo
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
@@ -25,7 +25,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/cgroups"
|
||||
"github.com/containerd/cgroups/v3"
|
||||
"github.com/containerd/containerd/contrib/apparmor"
|
||||
"github.com/containerd/containerd/contrib/seccomp"
|
||||
"github.com/containerd/containerd/oci"
|
||||
|
||||
@@ -21,8 +21,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
v1 "github.com/containerd/cgroups/stats/v1"
|
||||
v2 "github.com/containerd/cgroups/v2/stats"
|
||||
v1 "github.com/containerd/cgroups/v3/cgroup1/stats"
|
||||
v2 "github.com/containerd/cgroups/v3/cgroup2/stats"
|
||||
containerstore "github.com/containerd/containerd/pkg/cri/store/container"
|
||||
"github.com/stretchr/testify/assert"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
|
||||
@@ -24,8 +24,9 @@ import (
|
||||
"github.com/containernetworking/plugins/pkg/ns"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
|
||||
"github.com/containerd/cgroups"
|
||||
cgroupsv2 "github.com/containerd/cgroups/v2"
|
||||
"github.com/containerd/cgroups/v3"
|
||||
"github.com/containerd/cgroups/v3/cgroup1"
|
||||
cgroupsv2 "github.com/containerd/cgroups/v3/cgroup2"
|
||||
|
||||
"github.com/vishvananda/netlink"
|
||||
|
||||
@@ -151,7 +152,7 @@ func metricsForSandbox(sandbox sandboxstore.Sandbox) (interface{}, error) {
|
||||
|
||||
var statsx interface{}
|
||||
if cgroups.Mode() == cgroups.Unified {
|
||||
cg, err := cgroupsv2.LoadManager("/sys/fs/cgroup", cgroupPath)
|
||||
cg, err := cgroupsv2.Load(cgroupPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load sandbox cgroup: %v: %w", cgroupPath, err)
|
||||
}
|
||||
@@ -162,11 +163,11 @@ func metricsForSandbox(sandbox sandboxstore.Sandbox) (interface{}, error) {
|
||||
statsx = stats
|
||||
|
||||
} else {
|
||||
control, err := cgroups.Load(cgroups.V1, cgroups.StaticPath(cgroupPath))
|
||||
control, err := cgroup1.Load(cgroup1.StaticPath(cgroupPath))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load sandbox cgroup %v: %w", cgroupPath, err)
|
||||
}
|
||||
stats, err := control.Stat(cgroups.IgnoreNotExist)
|
||||
stats, err := control.Stat(cgroup1.IgnoreNotExist)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get stats for cgroup %v: %w", cgroupPath, err)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/cgroups"
|
||||
"github.com/containerd/cgroups/v3"
|
||||
"github.com/containerd/containerd/contrib/apparmor"
|
||||
"github.com/containerd/containerd/contrib/seccomp"
|
||||
"github.com/containerd/containerd/oci"
|
||||
|
||||
@@ -21,8 +21,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
v1 "github.com/containerd/cgroups/stats/v1"
|
||||
v2 "github.com/containerd/cgroups/v2/stats"
|
||||
v1 "github.com/containerd/cgroups/v3/cgroup1/stats"
|
||||
v2 "github.com/containerd/cgroups/v3/cgroup2/stats"
|
||||
"github.com/stretchr/testify/assert"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
)
|
||||
|
||||
@@ -24,8 +24,9 @@ import (
|
||||
"github.com/containernetworking/plugins/pkg/ns"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
|
||||
"github.com/containerd/cgroups"
|
||||
cgroupsv2 "github.com/containerd/cgroups/v2"
|
||||
"github.com/containerd/cgroups/v3"
|
||||
"github.com/containerd/cgroups/v3/cgroup1"
|
||||
cgroupsv2 "github.com/containerd/cgroups/v3/cgroup2"
|
||||
|
||||
"github.com/vishvananda/netlink"
|
||||
|
||||
@@ -151,7 +152,7 @@ func metricsForSandbox(sandbox sandboxstore.Sandbox) (interface{}, error) {
|
||||
|
||||
var statsx interface{}
|
||||
if cgroups.Mode() == cgroups.Unified {
|
||||
cg, err := cgroupsv2.LoadManager("/sys/fs/cgroup", cgroupPath)
|
||||
cg, err := cgroupsv2.Load(cgroupPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load sandbox cgroup: %v: %w", cgroupPath, err)
|
||||
}
|
||||
@@ -162,11 +163,11 @@ func metricsForSandbox(sandbox sandboxstore.Sandbox) (interface{}, error) {
|
||||
statsx = stats
|
||||
|
||||
} else {
|
||||
control, err := cgroups.Load(cgroups.V1, cgroups.StaticPath(cgroupPath))
|
||||
control, err := cgroup1.Load(cgroup1.StaticPath(cgroupPath))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load sandbox cgroup %v: %w", cgroupPath, err)
|
||||
}
|
||||
stats, err := control.Stat(cgroups.IgnoreNotExist)
|
||||
stats, err := control.Stat(cgroup1.IgnoreNotExist)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get stats for cgroup %v: %w", cgroupPath, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user