Skip to content

Commit

Permalink
Merge pull request #58 from thaJeztah/0.1_backport_remove_containerd_…
Browse files Browse the repository at this point in the history
…dependency

[release/0.1 backport] remove containerd as dependency
  • Loading branch information
mikebrow authored Nov 13, 2023
2 parents bcfcdd3 + 4275101 commit 51b5b48
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 796 deletions.
24 changes: 20 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
"os/exec"
"sync"

"github.com/containerd/containerd"
"github.com/containerd/containerd/oci"
types "github.com/containerd/nri/types/v1"

oci "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
)

Expand Down Expand Up @@ -74,13 +74,29 @@ type Sandbox struct {
Labels map[string]string
}

// process is a subset of containerd's Process interface.
type process interface {
// ID of the process
ID() string
// Pid is the system specific process id
Pid() uint32
}

// Task is a subset of containerd's Task interface.
type Task interface {
process

// Spec returns the current OCI specification for the task
Spec(context.Context) (*oci.Spec, error)
}

// Invoke the ConfList of nri plugins
func (c *Client) Invoke(ctx context.Context, task containerd.Task, state types.State) ([]*types.Result, error) {
func (c *Client) Invoke(ctx context.Context, task Task, state types.State) ([]*types.Result, error) {
return c.InvokeWithSandbox(ctx, task, state, nil)
}

// InvokeWithSandbox invokes the ConfList of nri plugins
func (c *Client) InvokeWithSandbox(ctx context.Context, task containerd.Task, state types.State, sandbox *Sandbox) ([]*types.Result, error) {
func (c *Client) InvokeWithSandbox(ctx context.Context, task Task, state types.State, sandbox *Sandbox) ([]*types.Result, error) {
if len(c.conf.Plugins) == 0 {
return nil, nil
}
Expand Down
10 changes: 1 addition & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ module github.com/containerd/nri
go 1.14

require (
// when updating containerd, adjust the replace rules accordingly
github.com/containerd/containerd v1.5.0-beta.3
github.com/opencontainers/runtime-spec v1.0.2
github.com/pkg/errors v0.9.1
)

replace (
github.com/gogo/googleapis => github.com/gogo/googleapis v1.3.2
github.com/golang/protobuf => github.com/golang/protobuf v1.3.5
google.golang.org/genproto => google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63
google.golang.org/grpc => google.golang.org/grpc v1.27.1
)
Loading

0 comments on commit 51b5b48

Please sign in to comment.