Skip to content

Commit 0ce93e1

Browse files
zhaodiaoerk8s-infra-cherrypick-robot
authored andcommitted
prevent oom watcher depend on shim pkg.
Signed-off-by: Lei Liu <[email protected]>
1 parent 6b4c4a1 commit 0ce93e1

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

pkg/oom/v1/v1.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ import (
2525

2626
"github.com/containerd/cgroups/v3/cgroup1"
2727
eventstypes "github.com/containerd/containerd/api/events"
28+
"github.com/containerd/containerd/v2/core/events"
2829
"github.com/containerd/containerd/v2/core/runtime"
2930
"github.com/containerd/containerd/v2/pkg/oom"
30-
"github.com/containerd/containerd/v2/pkg/shim"
3131
"github.com/containerd/containerd/v2/pkg/sys"
3232
"github.com/containerd/log"
3333
"golang.org/x/sys/unix"
3434
)
3535

3636
// New returns an epoll implementation that listens to OOM events
3737
// from a container's cgroups.
38-
func New(publisher shim.Publisher) (oom.Watcher, error) {
38+
func New(publisher events.Publisher) (oom.Watcher, error) {
3939
fd, err := unix.EpollCreate1(unix.EPOLL_CLOEXEC)
4040
if err != nil {
4141
return nil, err
@@ -52,7 +52,7 @@ type epoller struct {
5252
mu sync.Mutex
5353

5454
fd int
55-
publisher shim.Publisher
55+
publisher events.Publisher
5656
set map[uintptr]*item
5757
}
5858

pkg/oom/v2/v2.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ import (
2424

2525
cgroupsv2 "github.com/containerd/cgroups/v3/cgroup2"
2626
eventstypes "github.com/containerd/containerd/api/events"
27+
"github.com/containerd/containerd/v2/core/events"
2728
"github.com/containerd/containerd/v2/core/runtime"
2829
"github.com/containerd/containerd/v2/pkg/oom"
29-
"github.com/containerd/containerd/v2/pkg/shim"
3030
"github.com/containerd/log"
3131
)
3232

3333
// New returns an implementation that listens to OOM events
3434
// from a container's cgroups.
35-
func New(publisher shim.Publisher) (oom.Watcher, error) {
35+
func New(publisher events.Publisher) (oom.Watcher, error) {
3636
return &watcher{
3737
itemCh: make(chan item),
3838
publisher: publisher,
@@ -42,7 +42,7 @@ func New(publisher shim.Publisher) (oom.Watcher, error) {
4242
// watcher implementation for handling OOM events from a container's cgroup
4343
type watcher struct {
4444
itemCh chan item
45-
publisher shim.Publisher
45+
publisher events.Publisher
4646
}
4747

4848
type item struct {

0 commit comments

Comments
 (0)