Skip to content

Commit f6acbf1

Browse files
committed
remove containerd as dependency
Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit da8a7e5) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent bcfcdd3 commit f6acbf1

3 files changed

Lines changed: 22 additions & 796 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
"github.com/pkg/errors"
3232
)
3333

@@ -74,13 +74,29 @@ type Sandbox struct {
7474
Labels map[string]string
7575
}
7676

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

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

go.mod

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@ module github.com/containerd/nri
33
go 1.14
44

55
require (
6-
// when updating containerd, adjust the replace rules accordingly
7-
github.com/containerd/containerd v1.5.0-beta.3
6+
github.com/opencontainers/runtime-spec v1.0.2
87
github.com/pkg/errors v0.9.1
98
)
10-
11-
replace (
12-
github.com/gogo/googleapis => github.com/gogo/googleapis v1.3.2
13-
github.com/golang/protobuf => github.com/golang/protobuf v1.3.5
14-
google.golang.org/genproto => google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63
15-
google.golang.org/grpc => google.golang.org/grpc v1.27.1
16-
)

0 commit comments

Comments
 (0)