Documentation ¶
Overview ¶
Package deviceplugin implement utility k8s device plugin of VPC-ENI resources.
Index ¶
- Constants
- Variables
- type ENIDevicePlugin
- func (eniPlugin ENIDevicePlugin) Allocate(_ context.Context, request *pluginapi.AllocateRequest) (*pluginapi.AllocateResponse, error)
- func (eniPlugin ENIDevicePlugin) GetDevicePluginOptions(_ context.Context, _ *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)
- func (eniPlugin ENIDevicePlugin) GetPreferredAllocation(_ context.Context, _ *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error)
- func (eniPlugin ENIDevicePlugin) ListAndWatch(_ *pluginapi.Empty, stream pluginapi.DevicePlugin_ListAndWatchServer) error
- func (eniPlugin ENIDevicePlugin) PreStartContainer(_ context.Context, _ *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error)
- type ENIType
- type Kubelet
- type Manager
- type PluginManager
- type PluginManagerOption
- func (option *PluginManagerOption) BuildManager() Manager
- func (option *PluginManagerOption) UseBranchENI() *PluginManagerOption
- func (option *PluginManagerOption) UseExclusiveENI() *PluginManagerOption
- func (option *PluginManagerOption) UseSharedENI() *PluginManagerOption
- func (option *PluginManagerOption) WithBranchENILister(lister func() int) *PluginManagerOption
- func (option *PluginManagerOption) WithContext(ctx context.Context) *PluginManagerOption
- func (option *PluginManagerOption) WithDryRun() *PluginManagerOption
- func (option *PluginManagerOption) WithENILister(lister func() int) *PluginManagerOption
- func (option *PluginManagerOption) WithIPLister(lister func() int) *PluginManagerOption
Constants ¶
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.
const ( Exclusive = iota Trunk )
Variables ¶
var DevicePluginPath = pluginapi.DevicePluginPath
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 ¶
func (eniPlugin ENIDevicePlugin) Allocate(_ context.Context, request *pluginapi.AllocateRequest) (*pluginapi.AllocateResponse, error)
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 ¶
func (eniPlugin ENIDevicePlugin) GetPreferredAllocation(_ context.Context, _ *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error)
GetPreferredAllocation is not supported by this plugin.
func (ENIDevicePlugin) ListAndWatch ¶
func (eniPlugin ENIDevicePlugin) ListAndWatch(_ *pluginapi.Empty, stream pluginapi.DevicePlugin_ListAndWatchServer) error
ListAndWatch returns ENI devices list.
func (ENIDevicePlugin) PreStartContainer ¶
func (eniPlugin ENIDevicePlugin) PreStartContainer(_ context.Context, _ *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error)
PreStartContainer is not supported by this plugin.
type Kubelet ¶
Kubelet MockClient is a mock RPC client of kubelet for testing purpose.
func NewMockClient ¶
func NewMockClient() *Kubelet
func (*Kubelet) Registered ¶
func (*Kubelet) StartServer ¶
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