types

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SockDir is the default Kubelet device plugin socket directory
	SockDir = "/var/lib/kubelet/device-plugins"
	// KubeEndPoint is kubelet socket name
	KubeEndPoint = "kubelet.sock"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IBaseResource

type IBaseResource interface {
	GetDeviceFile(dev string) (devFile string, err error)
	GetDeviceSpecs(deviceFiles map[string]string, deviceIDs []string) []*pluginapi.DeviceSpec
	GetEnvs(deviceIDs []string) map[string]string
	GetMounts() []*pluginapi.Mount
	// Probe does device health-check and update devices and returns 'true' if any of device in resource pool changed
	Probe(*ResourceConfig, map[string]*pluginapi.Device) bool
}

IBaseResource represents a specific resource pool

type ResourceConfList

type ResourceConfList struct {
	ResourceList []ResourceConfig `json:"resourceList"` // config file: "resourceList" :[{<ResourceConfig configs>},{},{},...]
}

ResourceConfList is list of ResourceConfig

type ResourceConfig

type ResourceConfig struct {
	ResourceName string   `json:"resourceName"`         // the resource name will be added with resource prefix in K8s api
	RootDevices  []string `json:"rootDevices"`          // list of PCI address of root devices e.g. "0000:05:00.0",
	DeviceType   string   `json:"deviceType,omitempty"` // Device driver type of the device
	SriovMode    bool     `json:"sriovMode,omitempty"`  // Whether devices have SRIOV virtual function capabilities or not
}

ResourceConfig contains cofiguration paremeters for a resource pool

type ResourceFactory

type ResourceFactory interface {
	GetResourceServer(ResourcePool) (ResourceServer, error)
	GetResourcePool(*ResourceConfig) ResourcePool
}

ResourceFactory is an interface to get instances of ResourcePool and ResouceServer

type ResourcePool

type ResourcePool interface {
	// extended API for internal use
	InitDevice() error
	DiscoverDevices() error
	GetResourceName() string
	GetConfig() *ResourceConfig

	GetDevices() map[string]*pluginapi.Device // for ListAndWatch
	GetDeviceFiles() map[string]string
	IBaseResource
}

ResourcePool represents a generic resource entity

type ResourceServer

type ResourceServer interface {
	// Device manager API
	pluginapi.DevicePluginServer
	// grpc server related
	Start() error
	Stop() error
	// Init initializes resourcePool
	Init() error
	// Watch watches for socket file deleteion and restart server if needed
	Watch()
}

ResourceServer is gRPC server implements K8s device plugin api

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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