Skip to content

Commit da8a7e5

Browse files
committed
remove containerd as dependency
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 976af01 commit da8a7e5

5 files changed

Lines changed: 28 additions & 1490 deletions

File tree

client.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ import (
2525
"os/exec"
2626
"sync"
2727

28-
"github.com/containerd/containerd"
29-
"github.com/containerd/containerd/oci"
3028
types "github.com/containerd/nri/types/v1"
29+
30+
oci "github.com/opencontainers/runtime-spec/specs-go"
3131
)
3232

3333
const (
@@ -73,13 +73,29 @@ type Sandbox struct {
7373
Labels map[string]string
7474
}
7575

76+
// process is a subset of containerd's Process interface.
77+
type process interface {
78+
// ID of the process
79+
ID() string
80+
// Pid is the system specific process id
81+
Pid() uint32
82+
}
83+
84+
// Task is ta subset of containerd's Task interface.
85+
type Task interface {
86+
process
87+
88+
// Spec returns the current OCI specification for the task
89+
Spec(context.Context) (*oci.Spec, error)
90+
}
91+
7692
// Invoke the ConfList of nri plugins
77-
func (c *Client) Invoke(ctx context.Context, task containerd.Task, state types.State) ([]*types.Result, error) {
93+
func (c *Client) Invoke(ctx context.Context, task Task, state types.State) ([]*types.Result, error) {
7894
return c.InvokeWithSandbox(ctx, task, state, nil)
7995
}
8096

8197
// InvokeWithSandbox invokes the ConfList of nri plugins
82-
func (c *Client) InvokeWithSandbox(ctx context.Context, task containerd.Task, state types.State, sandbox *Sandbox) ([]*types.Result, error) {
98+
func (c *Client) InvokeWithSandbox(ctx context.Context, task Task, state types.State, sandbox *Sandbox) ([]*types.Result, error) {
8399
if len(c.conf.Plugins) == 0 {
84100
return nil, nil
85101
}

go.mod

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ module github.com/containerd/nri
22

33
go 1.19
44

5-
// when updating containerd, adjust the replace rules accordingly
65
require (
7-
github.com/containerd/containerd v1.6.9
86
github.com/containerd/ttrpc v1.1.1-0.20220420014843-944ef4a40df3
97
github.com/moby/sys/mountinfo v0.6.2
8+
github.com/onsi/ginkgo/v2 v2.5.0
9+
github.com/onsi/gomega v1.24.0
1010
github.com/opencontainers/runtime-spec v1.0.3-0.20220825212826-86290f6a00fb
1111
github.com/opencontainers/runtime-tools v0.9.0
1212
github.com/sirupsen/logrus v1.8.1
@@ -18,39 +18,14 @@ require (
1818
)
1919

2020
require (
21-
github.com/onsi/ginkgo/v2 v2.5.0
22-
github.com/onsi/gomega v1.24.0
23-
)
24-
25-
require (
26-
github.com/Microsoft/go-winio v0.5.2 // indirect
27-
github.com/Microsoft/hcsshim v0.9.4 // indirect
28-
github.com/containerd/cgroups v1.0.3 // indirect
29-
github.com/containerd/continuity v0.3.0 // indirect
30-
github.com/containerd/fifo v1.0.0 // indirect
31-
github.com/containerd/typeurl v1.0.2 // indirect
3221
github.com/davecgh/go-spew v1.1.1 // indirect
33-
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
3422
github.com/go-logr/logr v1.2.3 // indirect
35-
github.com/gogo/googleapis v1.4.0 // indirect
3623
github.com/gogo/protobuf v1.3.2 // indirect
37-
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3824
github.com/golang/protobuf v1.5.2 // indirect
3925
github.com/google/go-cmp v0.5.9 // indirect
40-
github.com/google/uuid v1.3.0 // indirect
41-
github.com/klauspost/compress v1.11.13 // indirect
42-
github.com/moby/locker v1.0.1 // indirect
43-
github.com/moby/sys/signal v0.6.0 // indirect
44-
github.com/opencontainers/go-digest v1.0.0 // indirect
45-
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect
46-
github.com/opencontainers/runc v1.1.2 // indirect
47-
github.com/opencontainers/selinux v1.10.1 // indirect
48-
github.com/pkg/errors v0.9.1 // indirect
4926
github.com/pmezard/go-difflib v1.0.0 // indirect
5027
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
51-
go.opencensus.io v0.23.0 // indirect
5228
golang.org/x/net v0.1.0 // indirect
53-
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
5429
golang.org/x/text v0.4.0 // indirect
5530
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect
5631
google.golang.org/grpc v1.47.0 // indirect

0 commit comments

Comments
 (0)