adaptation

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2025 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DefaultPluginPath is the default path to search for NRI plugins.
	DefaultPluginPath = "/opt/nri/plugins"
	// DefaultSocketPath is the default socket path for external plugins.
	DefaultSocketPath = api.DefaultSocketPath
	// PluginConfigDir is the drop-in directory for NRI-launched plugin configuration.
	DefaultPluginConfigPath = "/etc/nri/conf.d"
)
View Source
const (
	Event_UNKNOWN                       = api.Event_UNKNOWN
	Event_RUN_POD_SANDBOX               = api.Event_RUN_POD_SANDBOX
	Event_UPDATE_POD_SANDBOX            = api.Event_UPDATE_POD_SANDBOX
	Event_POST_UPDATE_POD_SANDBOX       = api.Event_POST_UPDATE_POD_SANDBOX
	Event_STOP_POD_SANDBOX              = api.Event_STOP_POD_SANDBOX
	Event_REMOVE_POD_SANDBOX            = api.Event_REMOVE_POD_SANDBOX
	Event_CREATE_CONTAINER              = api.Event_CREATE_CONTAINER
	Event_POST_CREATE_CONTAINER         = api.Event_POST_CREATE_CONTAINER
	Event_START_CONTAINER               = api.Event_START_CONTAINER
	Event_POST_START_CONTAINER          = api.Event_POST_START_CONTAINER
	Event_UPDATE_CONTAINER              = api.Event_UPDATE_CONTAINER
	Event_POST_UPDATE_CONTAINER         = api.Event_POST_UPDATE_CONTAINER
	Event_STOP_CONTAINER                = api.Event_STOP_CONTAINER
	Event_REMOVE_CONTAINER              = api.Event_REMOVE_CONTAINER
	Event_VALIDATE_CONTAINER_ADJUSTMENT = api.Event_VALIDATE_CONTAINER_ADJUSTMENT
	ValidEvents                         = api.ValidEvents

	ContainerState_CONTAINER_UNKNOWN = api.ContainerState_CONTAINER_UNKNOWN
	ContainerState_CONTAINER_CREATED = api.ContainerState_CONTAINER_CREATED
	ContainerState_CONTAINER_PAUSED  = api.ContainerState_CONTAINER_PAUSED
	ContainerState_CONTAINER_RUNNING = api.ContainerState_CONTAINER_RUNNING
	ContainerState_CONTAINER_STOPPED = api.ContainerState_CONTAINER_STOPPED
	ContainerState_CONTAINER_EXITED  = api.ContainerState_CONTAINER_STOPPED

	SecurityProfile_RUNTIME_DEFAULT = api.SecurityProfile_RUNTIME_DEFAULT
	SecurityProfile_UNCONFINED      = api.SecurityProfile_UNCONFINED
	SecurityProfile_LOCALHOST       = api.SecurityProfile_LOCALHOST
)

Aliased consts for api/api.proto. nolint

View Source
const (
	// DefaultPluginRegistrationTimeout is the default timeout for plugin registration.
	DefaultPluginRegistrationTimeout = api.DefaultPluginRegistrationTimeout
	// DefaultPluginRequestTimeout is the default timeout for plugins to handle a request.
	DefaultPluginRequestTimeout = api.DefaultPluginRequestTimeout
)

Variables

View Source
var (
	String   = api.String
	Int      = api.Int
	Int32    = api.Int32
	UInt32   = api.UInt32
	Int64    = api.Int64
	UInt64   = api.UInt64
	Bool     = api.Bool
	FileMode = api.FileMode
)

Aliased functions for api/optional.go. nolint

View Source
var (
	FromOCIMounts          = api.FromOCIMounts
	FromOCIHooks           = api.FromOCIHooks
	FromOCILinuxNamespaces = api.FromOCILinuxNamespaces
	FromOCILinuxDevices    = api.FromOCILinuxDevices
	FromOCILinuxResources  = api.FromOCILinuxResources
	FromOCILinuxIOPriority = api.FromOCILinuxIOPriority
	DupStringSlice         = api.DupStringSlice
	DupStringMap           = api.DupStringMap
	IsMarkedForRemoval     = api.IsMarkedForRemoval
	MarkForRemoval         = api.MarkForRemoval
)

Aliased functions for api/types.go. nolint

Functions

func SetPluginRegistrationTimeout added in v0.3.0

func SetPluginRegistrationTimeout(t time.Duration)

SetPluginRegistrationTimeout sets the timeout for plugin registration.

func SetPluginRequestTimeout added in v0.3.0

func SetPluginRequestTimeout(t time.Duration)

SetPluginRequestTimeout sets the timeout for plugins to handle a request.

Types

type Adaptation

type Adaptation struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Adaptation is the NRI abstraction for container runtime NRI adaptation/integration.

func New

func New(name, version string, syncFn SyncFn, updateFn UpdateFn, opts ...Option) (*Adaptation, error)

New creates a new NRI Runtime.

func (*Adaptation) BlockPluginSync added in v0.7.0

func (r *Adaptation) BlockPluginSync() *PluginSyncBlock

BlockPluginSync blocks plugins from being synchronized/fully registered.

func (*Adaptation) CreateContainer

CreateContainer relays the corresponding CRI request to plugins.

func (*Adaptation) PostCreateContainer

func (r *Adaptation) PostCreateContainer(ctx context.Context, evt *StateChangeEvent) error

PostCreateContainer relays the corresponding CRI event to plugins.

func (*Adaptation) PostStartContainer

func (r *Adaptation) PostStartContainer(ctx context.Context, evt *StateChangeEvent) error

PostStartContainer relays the corresponding CRI event to plugins.

func (*Adaptation) PostUpdateContainer

func (r *Adaptation) PostUpdateContainer(ctx context.Context, evt *StateChangeEvent) error

PostUpdateContainer relays the corresponding CRI event to plugins.

func (*Adaptation) PostUpdatePodSandbox added in v0.10.0

func (r *Adaptation) PostUpdatePodSandbox(ctx context.Context, evt *StateChangeEvent) error

PostUpdatePodSandbox relays the corresponding CRI event to plugins.

func (*Adaptation) RemoveContainer

func (r *Adaptation) RemoveContainer(ctx context.Context, evt *StateChangeEvent) error

RemoveContainer relays the corresponding CRI event to plugins.

func (*Adaptation) RemovePodSandbox

func (r *Adaptation) RemovePodSandbox(ctx context.Context, evt *StateChangeEvent) error

RemovePodSandbox relays the corresponding CRI event to plugins.

func (*Adaptation) RunPodSandbox

func (r *Adaptation) RunPodSandbox(ctx context.Context, evt *StateChangeEvent) error

RunPodSandbox relays the corresponding CRI event to plugins.

func (*Adaptation) Start

func (r *Adaptation) Start() error

Start up the NRI runtime.

func (*Adaptation) StartContainer

func (r *Adaptation) StartContainer(ctx context.Context, evt *StateChangeEvent) error

StartContainer relays the corresponding CRI event to plugins.

func (*Adaptation) StateChange

func (r *Adaptation) StateChange(ctx context.Context, evt *StateChangeEvent) error

StateChange relays pod- or container events to plugins.

func (*Adaptation) Stop

func (r *Adaptation) Stop()

Stop the NRI runtime.

func (*Adaptation) StopContainer

StopContainer relays the corresponding CRI request to plugins.

func (*Adaptation) StopPodSandbox

func (r *Adaptation) StopPodSandbox(ctx context.Context, evt *StateChangeEvent) error

StopPodSandbox relays the corresponding CRI event to plugins.

func (*Adaptation) UpdateContainer

UpdateContainer relays the corresponding CRI request to plugins.

func (*Adaptation) UpdatePodSandbox added in v0.10.0

UpdatePodSandbox relays the corresponding CRI request to plugins.

type CDIDevice added in v0.7.0

type CDIDevice = api.CDIDevice

Aliased request/response/event types for api/api.proto. nolint

type ConfigureRequest

type ConfigureRequest = api.ConfigureRequest

Aliased request/response/event types for api/api.proto. nolint

type ConfigureResponse

type ConfigureResponse = api.ConfigureResponse

Aliased request/response/event types for api/api.proto. nolint

type Container

type Container = api.Container

Aliased request/response/event types for api/api.proto. nolint

type ContainerAdjustment

type ContainerAdjustment = api.ContainerAdjustment

Aliased request/response/event types for api/api.proto. nolint

type ContainerEviction

type ContainerEviction = api.ContainerEviction

Aliased request/response/event types for api/api.proto. nolint

type ContainerState

type ContainerState = api.ContainerState

Aliased request/response/event types for api/api.proto. nolint

type ContainerUpdate

type ContainerUpdate = api.ContainerUpdate

Aliased request/response/event types for api/api.proto. nolint

type CreateContainerRequest

type CreateContainerRequest = api.CreateContainerRequest

Aliased request/response/event types for api/api.proto. nolint

type CreateContainerResponse

type CreateContainerResponse = api.CreateContainerResponse

Aliased request/response/event types for api/api.proto. nolint

type EventMask

type EventMask = api.EventMask

Aliased request/response/event types for api/api.proto. nolint

type Hook

type Hook = api.Hook

Aliased request/response/event types for api/api.proto. nolint

type Hooks

type Hooks = api.Hooks

Aliased request/response/event types for api/api.proto. nolint

type HugepageLimit

type HugepageLimit = api.HugepageLimit

Aliased request/response/event types for api/api.proto. nolint

type KeyValue

type KeyValue = api.KeyValue

Aliased request/response/event types for api/api.proto. nolint

type LinuxCPU

type LinuxCPU = api.LinuxCPU

Aliased request/response/event types for api/api.proto. nolint

type LinuxContainer

type LinuxContainer = api.LinuxContainer

Aliased request/response/event types for api/api.proto. nolint

type LinuxContainerAdjustment

type LinuxContainerAdjustment = api.LinuxContainerAdjustment

Aliased request/response/event types for api/api.proto. nolint

type LinuxContainerUpdate

type LinuxContainerUpdate = api.LinuxContainerUpdate

Aliased request/response/event types for api/api.proto. nolint

type LinuxDevice

type LinuxDevice = api.LinuxDevice

Aliased request/response/event types for api/api.proto. nolint

type LinuxDeviceCgroup

type LinuxDeviceCgroup = api.LinuxDeviceCgroup

Aliased request/response/event types for api/api.proto. nolint

type LinuxIOPriority added in v0.10.0

type LinuxIOPriority = api.LinuxIOPriority

Aliased request/response/event types for api/api.proto. nolint

type LinuxMemory

type LinuxMemory = api.LinuxMemory

Aliased request/response/event types for api/api.proto. nolint

type LinuxNamespace

type LinuxNamespace = api.LinuxNamespace

Aliased request/response/event types for api/api.proto. nolint

type LinuxPodSandbox

type LinuxPodSandbox = api.LinuxPodSandbox

Aliased request/response/event types for api/api.proto. nolint

type LinuxResources

type LinuxResources = api.LinuxResources

Aliased request/response/event types for api/api.proto. nolint

type LinuxSeccomp added in v0.10.0

type LinuxSeccomp = api.LinuxSeccomp

Aliased request/response/event types for api/api.proto. nolint

type Mount

type Mount = api.Mount

Aliased request/response/event types for api/api.proto. nolint

type Option

type Option func(*Adaptation) error

Option to apply to the NRI runtime.

func WithBuiltinPlugins added in v0.10.0

func WithBuiltinPlugins(plugins ...*builtin.BuiltinPlugin) Option

WithBuiltinPlugins sets extra builtin plugins to register.

func WithDefaultValidator added in v0.10.0

func WithDefaultValidator(cfg *validator.DefaultValidatorConfig) Option

WithDefaultValidator sets up builtin validator plugin if it is configured.

func WithDisabledExternalConnections added in v0.3.0

func WithDisabledExternalConnections() Option

WithDisabledExternalConnections returns an options to disable accepting plugin connections.

func WithPluginConfigPath added in v0.3.0

func WithPluginConfigPath(path string) Option

WithPluginConfigPath returns an option to override the default NRI plugin config path.

func WithPluginPath

func WithPluginPath(path string) Option

WithPluginPath returns an option to override the default NRI plugin path.

func WithSocketPath

func WithSocketPath(path string) Option

WithSocketPath returns an option to override the default NRI socket path.

func WithTTRPCOptions added in v0.6.0

func WithTTRPCOptions(clientOpts []ttrpc.ClientOpts, serverOpts []ttrpc.ServerOpt) Option

WithTTRPCOptions sets extra client and server options to use for ttrpc.

type OptionalBool

type OptionalBool = api.OptionalBool

Aliased types for api/optional.go. nolint

type OptionalFileMode

type OptionalFileMode = api.OptionalFileMode

Aliased types for api/optional.go. nolint

type OptionalInt

type OptionalInt = api.OptionalInt

Aliased types for api/optional.go. nolint

type OptionalInt32

type OptionalInt32 = api.OptionalInt32

Aliased types for api/optional.go. nolint

type OptionalInt64

type OptionalInt64 = api.OptionalInt64

Aliased types for api/optional.go. nolint

type OptionalString

type OptionalString = api.OptionalString

Aliased types for api/optional.go. nolint

type OptionalUInt32

type OptionalUInt32 = api.OptionalUInt32

Aliased types for api/optional.go. nolint

type OptionalUInt64

type OptionalUInt64 = api.OptionalUInt64

Aliased types for api/optional.go. nolint

type POSIXRlimit added in v0.4.0

type POSIXRlimit = api.POSIXRlimit

Aliased request/response/event types for api/api.proto. nolint

type PluginInstance added in v0.10.0

type PluginInstance = api.PluginInstance

Aliased request/response/event types for api/api.proto. nolint

type PluginSyncBlock added in v0.7.0

type PluginSyncBlock struct {
	// contains filtered or unexported fields
}

func (*PluginSyncBlock) Unblock added in v0.7.0

func (b *PluginSyncBlock) Unblock()

Unblock a plugin sync. block put in place by BlockPluginSync. Safe to call multiple times but only from a single goroutine.

type PodSandbox

type PodSandbox = api.PodSandbox

Aliased request/response/event types for api/api.proto. nolint

type PostCreateContainerRequest

type PostCreateContainerRequest = api.PostCreateContainerRequest

Aliased request/response/event types for api/api.proto. nolint

type PostCreateContainerResponse

type PostCreateContainerResponse = api.PostCreateContainerResponse

Aliased request/response/event types for api/api.proto. nolint

type PostStartContainerRequest

type PostStartContainerRequest = api.PostStartContainerRequest

Aliased request/response/event types for api/api.proto. nolint

type PostStartContainerResponse

type PostStartContainerResponse = api.PostStartContainerResponse

Aliased request/response/event types for api/api.proto. nolint

type PostUpdateContainerRequest

type PostUpdateContainerRequest = api.PostUpdateContainerRequest

Aliased request/response/event types for api/api.proto. nolint

type PostUpdateContainerResponse

type PostUpdateContainerResponse = api.PostUpdateContainerResponse

Aliased request/response/event types for api/api.proto. nolint

type PostUpdatePodSandboxRequest added in v0.10.0

type PostUpdatePodSandboxRequest = api.PostUpdatePodSandboxRequest

Aliased request/response/event types for api/api.proto. nolint

type PostUpdatePodSandboxResponse added in v0.10.0

type PostUpdatePodSandboxResponse = api.PostUpdatePodSandboxResponse

Aliased request/response/event types for api/api.proto. nolint

type RegisterPluginRequest

type RegisterPluginRequest = api.RegisterPluginRequest

Aliased request/response/event types for api/api.proto. nolint

type RegisterPluginResponse

type RegisterPluginResponse = api.Empty

Aliased request/response/event types for api/api.proto. nolint

type RemoveContainerRequest

type RemoveContainerRequest = api.RemoveContainerRequest

Aliased request/response/event types for api/api.proto. nolint

type RemoveContainerResponse

type RemoveContainerResponse = api.RemoveContainerResponse

Aliased request/response/event types for api/api.proto. nolint

type RemovePodSandboxRequest

type RemovePodSandboxRequest = api.RemovePodSandboxRequest

Aliased request/response/event types for api/api.proto. nolint

type RunPodSandboxRequest

type RunPodSandboxRequest = api.RunPodSandboxRequest

Aliased request/response/event types for api/api.proto. nolint

type SecurityProfile added in v0.10.0

type SecurityProfile = api.SecurityProfile

Aliased request/response/event types for api/api.proto. nolint

type ShutdownRequest added in v0.10.0

type ShutdownRequest = api.Empty

Aliased request/response/event types for api/api.proto. nolint

type ShutdownResponse added in v0.10.0

type ShutdownResponse = api.Empty

Aliased request/response/event types for api/api.proto. nolint

type StartContainerRequest

type StartContainerRequest = api.StartContainerRequest

Aliased request/response/event types for api/api.proto. nolint

type StartContainerResponse

type StartContainerResponse = api.StartContainerResponse

Aliased request/response/event types for api/api.proto. nolint

type StateChangeEvent

type StateChangeEvent = api.StateChangeEvent

Aliased request/response/event types for api/api.proto. nolint

type StateChangeResponse

type StateChangeResponse = api.StateChangeResponse

Aliased request/response/event types for api/api.proto. nolint

type StopContainerRequest

type StopContainerRequest = api.StopContainerRequest

Aliased request/response/event types for api/api.proto. nolint

type StopContainerResponse

type StopContainerResponse = api.StopContainerResponse

Aliased request/response/event types for api/api.proto. nolint

type StopPodSandboxRequest

type StopPodSandboxRequest = api.StopPodSandboxRequest

Aliased request/response/event types for api/api.proto. nolint

type SyncCB

type SyncCB func(context.Context, []*PodSandbox, []*Container) ([]*ContainerUpdate, error)

SyncCB is an NRI function used to synchronize plugins with the runtime.

type SyncFn

type SyncFn func(context.Context, SyncCB) error

SyncFn is a container runtime function for state synchronization.

type SynchronizeRequest

type SynchronizeRequest = api.SynchronizeRequest

Aliased request/response/event types for api/api.proto. nolint

type SynchronizeResponse

type SynchronizeResponse = api.SynchronizeResponse

Aliased request/response/event types for api/api.proto. nolint

type UpdateContainerRequest

type UpdateContainerRequest = api.UpdateContainerRequest

Aliased request/response/event types for api/api.proto. nolint

type UpdateContainerResponse

type UpdateContainerResponse = api.UpdateContainerResponse

Aliased request/response/event types for api/api.proto. nolint

type UpdateContainersRequest

type UpdateContainersRequest = api.UpdateContainersRequest

Aliased request/response/event types for api/api.proto. nolint

type UpdateContainersResponse

type UpdateContainersResponse = api.UpdateContainersResponse

Aliased request/response/event types for api/api.proto. nolint

type UpdateFn

type UpdateFn func(context.Context, []*ContainerUpdate) ([]*ContainerUpdate, error)

UpdateFn is a container runtime function for unsolicited container updates.

type UpdatePodSandboxRequest added in v0.10.0

type UpdatePodSandboxRequest = api.UpdatePodSandboxRequest

Aliased request/response/event types for api/api.proto. nolint

type UpdatePodSandboxResponse added in v0.10.0

type UpdatePodSandboxResponse = api.UpdatePodSandboxResponse

Aliased request/response/event types for api/api.proto. nolint

type ValidateContainerAdjustmentRequest added in v0.10.0

type ValidateContainerAdjustmentRequest = api.ValidateContainerAdjustmentRequest

Aliased request/response/event types for api/api.proto. nolint

type ValidateContainerAdjustmentResponse added in v0.10.0

type ValidateContainerAdjustmentResponse = api.ValidateContainerAdjustmentResponse

Aliased request/response/event types for api/api.proto. nolint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL