vendor: github.com/containerd/nri v0.5.0

This version no longer has a dependency on containerd, cutting
down the number of circular dependencies.

full diff: https://github.com/containerd/nri/compare/v0.4.0...v0.5.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2023-09-13 11:09:12 +02:00
parent 31b6cdfd10
commit 8cbb4ea5d3
6 changed files with 31 additions and 19 deletions

View File

@@ -42,6 +42,7 @@ PLUGINS := \
$(BIN_PATH)/device-injector \
$(BIN_PATH)/hook-injector \
$(BIN_PATH)/differ \
$(BIN_PATH)/ulimit-adjuster \
$(BIN_PATH)/v010-adapter \
$(BIN_PATH)/template
@@ -105,6 +106,10 @@ $(BIN_PATH)/differ: $(wildcard plugins/differ/*.go)
$(Q)echo "Building $@..."; \
cd $(dir $<) && $(GO_BUILD) -o $@ .
$(BIN_PATH)/ulimit-adjuster: $(wildcard plugins/ulimit-adjuster/*.go)
$(Q)echo "Building $@..."; \
cd $(dir $<) && $(GO_BUILD) -o $@ .
$(BIN_PATH)/v010-adapter: $(wildcard plugins/v010-adapter/*.go)
$(Q)echo "Building $@..."; \
cd $(dir $<) && $(GO_BUILD) -o $@ .
@@ -136,7 +141,7 @@ ginkgo-tests:
$(GO_CMD) tool cover -html=$(COVERAGE_PATH)/coverprofile -o $(COVERAGE_PATH)/coverage.html
test-ulimits:
$(Q)$(GO_TEST) -v ./plugins/ulimit-adjuster
$(Q)cd ./plugins/ulimit-adjuster && $(GO_TEST) -v
codecov: SHELL := $(shell which bash)
codecov:

View File

@@ -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"
)
const (
@@ -73,13 +73,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 ta 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
}