endpoint

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint interface {
	Stop()
	Allocate(c context.Context, resourceRequest *pluginapi.ResourceRequest) (*pluginapi.ResourceAllocationResponse, error)
	GetTopologyHints(c context.Context, resourceRequest *pluginapi.ResourceRequest) (*pluginapi.ResourceHintsResponse, error)
	GetResourceAllocation(c context.Context, request *pluginapi.GetResourcesAllocationRequest) (*pluginapi.GetResourcesAllocationResponse, error)
	RemovePod(c context.Context, removePodRequest *pluginapi.RemovePodRequest) (*pluginapi.RemovePodResponse, error)
	IsStopped() bool
	StopGracePeriodExpired() bool
	GetResourcePluginOptions(ctx context.Context, in *pluginapi.Empty, opts ...grpc.CallOption) (*pluginapi.ResourcePluginOptions, error)
	GetTopologyAwareAllocatableResources(c context.Context, request *pluginapi.GetTopologyAwareAllocatableResourcesRequest) (*pluginapi.GetTopologyAwareAllocatableResourcesResponse, error)
	GetTopologyAwareResources(c context.Context, request *pluginapi.GetTopologyAwareResourcesRequest) (*pluginapi.GetTopologyAwareResourcesResponse, error)
}

Endpoint maps to a single registered resource plugin. It is responsible for managing gRPC communications with the resource plugin and caching resource states reported by the resource plugin.

type EndpointImpl

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

func NewEndpointImpl

func NewEndpointImpl(socketPath, resourceName string) (*EndpointImpl, error)

NewEndpointImpl creates a new endpoint for the given resourceName. This is to be used during normal resource plugin registration.

func NewStoppedEndpointImpl

func NewStoppedEndpointImpl(resourceName string) *EndpointImpl

NewStoppedEndpointImpl creates a new endpoint for the given resourceName with stopTime set. This is to be used during Kubelet restart, before the actual resource plugin re-registers.

func (*EndpointImpl) Allocate

allocate issues Allocate gRPC call to the resource plugin.

func (*EndpointImpl) Client

func (*EndpointImpl) GetResourcePluginOptions

func (e *EndpointImpl) GetResourcePluginOptions(ctx context.Context, in *pluginapi.Empty, opts ...grpc.CallOption) (*pluginapi.ResourcePluginOptions, error)

func (*EndpointImpl) GetTopologyAwareResources added in v0.4.2

func (*EndpointImpl) GetTopologyHints

func (e *EndpointImpl) GetTopologyHints(c context.Context, resourceRequest *pluginapi.ResourceRequest) (*pluginapi.ResourceHintsResponse, error)

func (*EndpointImpl) IsStopped

func (e *EndpointImpl) IsStopped() bool

func (*EndpointImpl) RemovePod

func (e *EndpointImpl) RemovePod(c context.Context, removePodRequest *pluginapi.RemovePodRequest) (*pluginapi.RemovePodResponse, error)

func (*EndpointImpl) Stop

func (e *EndpointImpl) Stop()

func (*EndpointImpl) StopGracePeriodExpired

func (e *EndpointImpl) StopGracePeriodExpired() bool

type EndpointInfo

type EndpointInfo struct {
	E    Endpoint
	Opts *pluginapi.ResourcePluginOptions
}

type Stub

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

func NewResourcePluginStub

func NewResourcePluginStub(socket string, name string, preStartContainerFlag bool) *Stub

NewResourcePluginStub returns an initialized ResourcePlugin Stub.

func (*Stub) Allocate

Allocate does a mock allocation

func (*Stub) GetInfo

GetInfo is the RPC which return pluginInfo

func (*Stub) GetResourcePluginOptions

func (m *Stub) GetResourcePluginOptions(ctx context.Context, e *pluginapi.Empty) (*pluginapi.ResourcePluginOptions, error)

GetResourcePluginOptions returns ResourcePluginOptions settings for the resource plugin.

func (*Stub) GetResourcesAllocation

GetResourcesAllocation returns allocation results of corresponding resources

func (*Stub) GetTopologyAwareAllocatableResources

GetTopologyAwareResources returns corresponding allocatable resources as topology aware format

func (*Stub) GetTopologyAwareResources

GetTopologyAwareResources returns allocation results of corresponding resources as topology aware format

func (*Stub) GetTopologyHints

GetTopologyHints returns hints of corresponding resources

func (*Stub) NotifyRegistrationStatus

func (m *Stub) NotifyRegistrationStatus(ctx context.Context, status *watcherapi.RegistrationStatus) (*watcherapi.RegistrationStatusResponse, error)

NotifyRegistrationStatus receives the registration notification from watcher

func (*Stub) PreStartContainer

PreStartContainer resets the resources received

func (*Stub) Register

func (m *Stub) Register(kubeletEndpoint, resourceName string, pluginSockDir string) error

Register registers the resource plugin for the given resourceName with Kubelet.

func (*Stub) RemovePod

Notify the resource plugin that the pod has beed deleted, and the plugin should do some clear-up work.

func (*Stub) SetAllocFunc

func (m *Stub) SetAllocFunc(f stubAllocFunc1)

SetAllocFunc sets allocFunc of the resource plugin

func (*Stub) SetGetAllocFunc

func (m *Stub) SetGetAllocFunc(f stubAllocFunc2)

func (*Stub) SetGetTopologyAwareAllocatableResourcesFunc added in v0.4.2

func (m *Stub) SetGetTopologyAwareAllocatableResourcesFunc(f stubGetTopologyAwareAllocatableResourcesFunc)

func (*Stub) SetGetTopologyAwareResourcesFunc added in v0.4.2

func (m *Stub) SetGetTopologyAwareResourcesFunc(f stubGetTopologyAwareResourcesFunc)

func (*Stub) Start

func (m *Stub) Start() error

Start starts the gRPC server of the resource plugin. Can only be called once.

func (*Stub) Stop

func (m *Stub) Stop() error

Stop stops the gRPC server. Can be called without a prior Start and more than once. Not safe to be called concurrently by different goroutines!

Jump to

Keyboard shortcuts

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