Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorCode_name = map[int32]string{
		0:   "UNKNOWN",
		1:   "INCOMPATIBLE_CNI_VERSION",
		2:   "UNSUPPORTED_FIELD",
		3:   "UNKNOWN_CONTAINER",
		4:   "INVALID_ENVIRONMENT_VARIABLES",
		5:   "IO_FAILURE",
		6:   "DECODING_FAILURE",
		7:   "INVALID_NETWORK_CONFIG",
		11:  "TRY_AGAIN_LATER",
		999: "INTERNAL",
	}
	ErrorCode_value = map[string]int32{
		"UNKNOWN":                       0,
		"INCOMPATIBLE_CNI_VERSION":      1,
		"UNSUPPORTED_FIELD":             2,
		"UNKNOWN_CONTAINER":             3,
		"INVALID_ENVIRONMENT_VARIABLES": 4,
		"IO_FAILURE":                    5,
		"DECODING_FAILURE":              6,
		"INVALID_NETWORK_CONFIG":        7,
		"TRY_AGAIN_LATER":               11,
		"INTERNAL":                      999,
	}
)

Enum value maps for ErrorCode.

View Source
var File_pkg_cnirpc_cni_proto protoreflect.FileDescriptor

Functions

func RegisterCNIServer

func RegisterCNIServer(s *grpc.Server, srv CNIServer)

Types

type AddResponse

type AddResponse struct {
	Result []byte `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

AddResponse represents the response for ADD command.

`result` is a types.current.Result serialized into JSON. https://pkg.go.dev/github.com/containernetworking/cni@v0.8.0/pkg/types/current?tab=doc#Result

func (*AddResponse) Descriptor

func (*AddResponse) Descriptor() ([]byte, []int)

Deprecated: Use AddResponse.ProtoReflect.Descriptor instead.

func (*AddResponse) GetResult

func (x *AddResponse) GetResult() []byte

func (*AddResponse) ProtoMessage

func (*AddResponse) ProtoMessage()

func (*AddResponse) ProtoReflect

func (x *AddResponse) ProtoReflect() protoreflect.Message

func (*AddResponse) Reset

func (x *AddResponse) Reset()

func (*AddResponse) String

func (x *AddResponse) String() string

type CNIArgs

type CNIArgs struct {
	ContainerId string            `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
	Netns       string            `protobuf:"bytes,2,opt,name=netns,proto3" json:"netns,omitempty"`
	Ifname      string            `protobuf:"bytes,3,opt,name=ifname,proto3" json:"ifname,omitempty"`
	Args        map[string]string `` // Key-Value pairs parsed from CNI_ARGS
	/* 149-byte string literal not displayed */
	Path      string `protobuf:"bytes,5,opt,name=path,proto3" json:"path,omitempty"`
	StdinData []byte `protobuf:"bytes,6,opt,name=stdin_data,json=stdinData,proto3" json:"stdin_data,omitempty"`
	// contains filtered or unexported fields
}

CNIArgs is a mirror of cni.pkg.skel.CmdArgs struct. https://pkg.go.dev/github.com/containernetworking/cni@v0.8.0/pkg/skel?tab=doc#CmdArgs

func (*CNIArgs) Descriptor

func (*CNIArgs) Descriptor() ([]byte, []int)

Deprecated: Use CNIArgs.ProtoReflect.Descriptor instead.

func (*CNIArgs) GetArgs

func (x *CNIArgs) GetArgs() map[string]string

func (*CNIArgs) GetContainerId

func (x *CNIArgs) GetContainerId() string

func (*CNIArgs) GetIfname

func (x *CNIArgs) GetIfname() string

func (*CNIArgs) GetNetns

func (x *CNIArgs) GetNetns() string

func (*CNIArgs) GetPath

func (x *CNIArgs) GetPath() string

func (*CNIArgs) GetStdinData

func (x *CNIArgs) GetStdinData() []byte

func (*CNIArgs) ProtoMessage

func (*CNIArgs) ProtoMessage()

func (*CNIArgs) ProtoReflect

func (x *CNIArgs) ProtoReflect() protoreflect.Message

func (*CNIArgs) Reset

func (x *CNIArgs) Reset()

func (*CNIArgs) String

func (x *CNIArgs) String() string

type CNIClient

type CNIClient interface {
	Add(ctx context.Context, in *CNIArgs, opts ...grpc.CallOption) (*AddResponse, error)
	Del(ctx context.Context, in *CNIArgs, opts ...grpc.CallOption) (*empty.Empty, error)
	Check(ctx context.Context, in *CNIArgs, opts ...grpc.CallOption) (*empty.Empty, error)
}

CNIClient is the client API for CNI service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewCNIClient

func NewCNIClient(cc grpc.ClientConnInterface) CNIClient

type CNIError

type CNIError struct {
	Code    ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=pkg.cnirpc.ErrorCode" json:"code,omitempty"`
	Msg     string    `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	Details string    `protobuf:"bytes,3,opt,name=details,proto3" json:"details,omitempty"`
	// contains filtered or unexported fields
}

CNIError is a mirror of cin.pkg.types.Error struct. https://pkg.go.dev/github.com/containernetworking/cni@v0.8.0/pkg/types?tab=doc#Error

This should be added to *grpc.Status by WithDetails() https://pkg.go.dev/google.golang.org/grpc@v1.31.0/internal/status?tab=doc#Status.WithDetails

func (*CNIError) Descriptor

func (*CNIError) Descriptor() ([]byte, []int)

Deprecated: Use CNIError.ProtoReflect.Descriptor instead.

func (*CNIError) GetCode

func (x *CNIError) GetCode() ErrorCode

func (*CNIError) GetDetails

func (x *CNIError) GetDetails() string

func (*CNIError) GetMsg

func (x *CNIError) GetMsg() string

func (*CNIError) ProtoMessage

func (*CNIError) ProtoMessage()

func (*CNIError) ProtoReflect

func (x *CNIError) ProtoReflect() protoreflect.Message

func (*CNIError) Reset

func (x *CNIError) Reset()

func (*CNIError) String

func (x *CNIError) String() string

type CNIServer

type CNIServer interface {
	Add(context.Context, *CNIArgs) (*AddResponse, error)
	Del(context.Context, *CNIArgs) (*empty.Empty, error)
	Check(context.Context, *CNIArgs) (*empty.Empty, error)
	// contains filtered or unexported methods
}

CNIServer is the server API for CNI service. All implementations must embed UnimplementedCNIServer for forward compatibility

type ErrorCode

type ErrorCode int32

ErrorCode enumerates errors for CNIError

const (
	ErrorCode_UNKNOWN                       ErrorCode = 0
	ErrorCode_INCOMPATIBLE_CNI_VERSION      ErrorCode = 1
	ErrorCode_UNSUPPORTED_FIELD             ErrorCode = 2
	ErrorCode_UNKNOWN_CONTAINER             ErrorCode = 3
	ErrorCode_INVALID_ENVIRONMENT_VARIABLES ErrorCode = 4
	ErrorCode_IO_FAILURE                    ErrorCode = 5
	ErrorCode_DECODING_FAILURE              ErrorCode = 6
	ErrorCode_INVALID_NETWORK_CONFIG        ErrorCode = 7
	ErrorCode_TRY_AGAIN_LATER               ErrorCode = 11
	ErrorCode_INTERNAL                      ErrorCode = 999
)

func (ErrorCode) Descriptor

func (ErrorCode) Descriptor() protoreflect.EnumDescriptor

func (ErrorCode) Enum

func (x ErrorCode) Enum() *ErrorCode

func (ErrorCode) EnumDescriptor

func (ErrorCode) EnumDescriptor() ([]byte, []int)

Deprecated: Use ErrorCode.Descriptor instead.

func (ErrorCode) Number

func (x ErrorCode) Number() protoreflect.EnumNumber

func (ErrorCode) String

func (x ErrorCode) String() string

func (ErrorCode) Type

type UnimplementedCNIServer

type UnimplementedCNIServer struct {
}

UnimplementedCNIServer must be embedded to have forward compatible implementations.

func (UnimplementedCNIServer) Add

func (UnimplementedCNIServer) Check

func (UnimplementedCNIServer) Del

type UnsafeCNIServer

type UnsafeCNIServer interface {
	// contains filtered or unexported methods
}

UnsafeCNIServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CNIServer will result in compilation errors.