Merge pull request #11439 from k8s-infra-cherrypick-robot/cherry-pick-11433-to-release/2.0
[release/2.0] pkg: prevent oom watcher from depending on shim pkg
This commit is contained in:
commit
1bdee2c4b8
@ -25,9 +25,9 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/cgroups/v3/cgroup1"
|
"github.com/containerd/cgroups/v3/cgroup1"
|
||||||
eventstypes "github.com/containerd/containerd/api/events"
|
eventstypes "github.com/containerd/containerd/api/events"
|
||||||
|
"github.com/containerd/containerd/v2/core/events"
|
||||||
"github.com/containerd/containerd/v2/core/runtime"
|
"github.com/containerd/containerd/v2/core/runtime"
|
||||||
"github.com/containerd/containerd/v2/pkg/oom"
|
"github.com/containerd/containerd/v2/pkg/oom"
|
||||||
"github.com/containerd/containerd/v2/pkg/shim"
|
|
||||||
"github.com/containerd/containerd/v2/pkg/sys"
|
"github.com/containerd/containerd/v2/pkg/sys"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
@ -35,7 +35,7 @@ import (
|
|||||||
|
|
||||||
// New returns an epoll implementation that listens to OOM events
|
// New returns an epoll implementation that listens to OOM events
|
||||||
// from a container's cgroups.
|
// from a container's cgroups.
|
||||||
func New(publisher shim.Publisher) (oom.Watcher, error) {
|
func New(publisher events.Publisher) (oom.Watcher, error) {
|
||||||
fd, err := unix.EpollCreate1(unix.EPOLL_CLOEXEC)
|
fd, err := unix.EpollCreate1(unix.EPOLL_CLOEXEC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -52,7 +52,7 @@ type epoller struct {
|
|||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
|
|
||||||
fd int
|
fd int
|
||||||
publisher shim.Publisher
|
publisher events.Publisher
|
||||||
set map[uintptr]*item
|
set map[uintptr]*item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,15 +24,15 @@ import (
|
|||||||
|
|
||||||
cgroupsv2 "github.com/containerd/cgroups/v3/cgroup2"
|
cgroupsv2 "github.com/containerd/cgroups/v3/cgroup2"
|
||||||
eventstypes "github.com/containerd/containerd/api/events"
|
eventstypes "github.com/containerd/containerd/api/events"
|
||||||
|
"github.com/containerd/containerd/v2/core/events"
|
||||||
"github.com/containerd/containerd/v2/core/runtime"
|
"github.com/containerd/containerd/v2/core/runtime"
|
||||||
"github.com/containerd/containerd/v2/pkg/oom"
|
"github.com/containerd/containerd/v2/pkg/oom"
|
||||||
"github.com/containerd/containerd/v2/pkg/shim"
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// New returns an implementation that listens to OOM events
|
// New returns an implementation that listens to OOM events
|
||||||
// from a container's cgroups.
|
// from a container's cgroups.
|
||||||
func New(publisher shim.Publisher) (oom.Watcher, error) {
|
func New(publisher events.Publisher) (oom.Watcher, error) {
|
||||||
return &watcher{
|
return &watcher{
|
||||||
itemCh: make(chan item),
|
itemCh: make(chan item),
|
||||||
publisher: publisher,
|
publisher: publisher,
|
||||||
@ -42,7 +42,7 @@ func New(publisher shim.Publisher) (oom.Watcher, error) {
|
|||||||
// watcher implementation for handling OOM events from a container's cgroup
|
// watcher implementation for handling OOM events from a container's cgroup
|
||||||
type watcher struct {
|
type watcher struct {
|
||||||
itemCh chan item
|
itemCh chan item
|
||||||
publisher shim.Publisher
|
publisher events.Publisher
|
||||||
}
|
}
|
||||||
|
|
||||||
type item struct {
|
type item struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user