deviceplugin

package
v1.6.2-rc Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package deviceplugin implement utility k8s device plugin of VPC-ENI resources.

Index

Constants

View Source
const (
	// VolcNameSpace is a VKE prifix.
	VolcNameSpace = "vke.volcengine.com/"
	// ENIResourceName indicates exclusive ENI resource name.
	ENIResourceName = VolcNameSpace + "eni"
	// ENIIPResourceName indicates shared ENI ip addresses resource name.
	ENIIPResourceName = VolcNameSpace + "eni-ip"
	// BranchENIResourceName indicates truck ENI.
	BranchENIResourceName = VolcNameSpace + "branch-eni"
)

ResourceName.

View Source
const (
	Exclusive = iota
	Shared
	Trunk
)

Variables

View Source
var DevicePluginPath = pluginapi.DevicePluginPath
View Source
var KubeletSocket = DevicePluginPath + "kubelet.sock"

Functions

This section is empty.

Types

type ENIDevicePlugin

type ENIDevicePlugin struct {
	ENIType
	// contains filtered or unexported fields
}

ENIDevicePlugin implements the Kubernetes devices device deviceplugin API.

func NewENIDevicePlugin

func NewENIDevicePlugin(t ENIType, res *resource, list func() int) *ENIDevicePlugin

NewENIDevicePlugin creates a new ENIDevicePlugin.

func (ENIDevicePlugin) Allocate

Allocate does nothing, here we only return a void response.

func (ENIDevicePlugin) GetDevicePluginOptions

func (eniPlugin ENIDevicePlugin) GetDevicePluginOptions(_ context.Context, _ *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)

GetDevicePluginOptions returns options that ENI devices support.

func (ENIDevicePlugin) GetPreferredAllocation

GetPreferredAllocation is not supported by this plugin.

func (ENIDevicePlugin) ListAndWatch

ListAndWatch returns ENI devices list.

func (ENIDevicePlugin) PreStartContainer

PreStartContainer is not supported by this plugin.

type ENIType

type ENIType int

type Kubelet

type Kubelet struct {
	Res []deviceResource

	sync.Mutex
	// contains filtered or unexported fields
}

Kubelet MockClient is a mock RPC client of kubelet for testing purpose.

func NewMockClient

func NewMockClient() *Kubelet

func (*Kubelet) Register

func (m *Kubelet) Register(_ context.Context, request *pluginapi.RegisterRequest) (*pluginapi.Empty, error)

func (*Kubelet) Registered

func (m *Kubelet) Registered() bool

func (*Kubelet) StartServer

func (m *Kubelet) StartServer() error

func (*Kubelet) Stop

func (m *Kubelet) Stop() error

type Manager

type Manager interface {
	Serve(stopCh chan struct{}) error
	Stop()
	Update(count int)
}

Manager is the interface of device plugin manager.

type PluginManager

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

PluginManager manages all device plugins.

func NewPluginManagerWithOptions

func NewPluginManagerWithOptions(option *PluginManagerOption) *PluginManager

NewPluginManagerWithOptions creates a new PluginManager with given options.

func (*PluginManager) Serve

func (manager *PluginManager) Serve(stopCh chan struct{}) error

Serve starts device plugins server and watch kubelet restarts.

func (*PluginManager) Stop

func (manager *PluginManager) Stop()

Stop all grpc server and delete endpoints.

func (*PluginManager) Update

func (manager *PluginManager) Update(count int)

Update will emit count to res channel asynchronously.

type PluginManagerOption

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

func NewPluginManagerOption

func NewPluginManagerOption() *PluginManagerOption

func (*PluginManagerOption) BuildManager

func (option *PluginManagerOption) BuildManager() Manager

func (*PluginManagerOption) UseBranchENI

func (option *PluginManagerOption) UseBranchENI() *PluginManagerOption

func (*PluginManagerOption) UseExclusiveENI

func (option *PluginManagerOption) UseExclusiveENI() *PluginManagerOption

func (*PluginManagerOption) UseSharedENI

func (option *PluginManagerOption) UseSharedENI() *PluginManagerOption

func (*PluginManagerOption) WithBranchENILister

func (option *PluginManagerOption) WithBranchENILister(lister func() int) *PluginManagerOption

func (*PluginManagerOption) WithContext

func (option *PluginManagerOption) WithContext(ctx context.Context) *PluginManagerOption

func (*PluginManagerOption) WithDryRun

func (option *PluginManagerOption) WithDryRun() *PluginManagerOption

func (*PluginManagerOption) WithENILister

func (option *PluginManagerOption) WithENILister(lister func() int) *PluginManagerOption

func (*PluginManagerOption) WithIPLister

func (option *PluginManagerOption) WithIPLister(lister func() int) *PluginManagerOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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