Documentation ¶
Index ¶
- Constants
- Variables
- func AddPodBindAnnotation(oldPod *v1.Pod, boardID int) *v1.Pod
- func BoardIDFromResourceName(name string) (int64, error)
- func BuildDecimalMap(set sets.Int, startBit int) int64
- func BuildRequestOrinSet(pod *v1.Pod) sets.Int
- func IsBindingBoard(pod *v1.Pod) bool
- func IsCompletedPod(pod *v1.Pod) bool
- func IsOrinPod(pod *v1.Pod) bool
- func IsResourceExists(pod *v1.Pod, resourceName string) bool
- func NewManager(c Cache, clientSet kubernetes.Interface) *manager
- func NewScheduleCache() *scheduleCache
- func Normalize(maxPriority int, scores []int)
- func OrinIDFromResourceName(name string) (int64, error)
- func Parallelize(workers, pieces int, doWorkPiece func(i int))
- func RemovePodBindAnnotation(oldPod *v1.Pod) *v1.Pod
- type Allocator
- type AllocatorResult
- type BinpackAllocator
- type Cache
- type Controller
- type DecimalMap
- type Manager
- type Map
- type NodeInfo
- type SpreadAllocator
Constants ¶
View Source
const ( AllocatorPolicyBinPack = "binpack" AllocatorPolicySpread = "spread" BoardIDNotFount = -1 )
View Source
const DefaultOrinStartBit = 1
Variables ¶
View Source
var (
AllocatorMap = map[string]Allocator{AllocatorPolicyBinPack: &BinpackAllocator{}}
)
View Source
var (
KeyFunc = clientgocache.DeletionHandlingMetaNamespaceKeyFunc
)
Functions ¶
func AddPodBindAnnotation ¶
GetUpdatedPodAnnotationSpec updates pod annotation with devId
func BoardIDFromResourceName ¶
func IsBindingBoard ¶
func IsCompletedPod ¶
func NewManager ¶
func NewManager(c Cache, clientSet kubernetes.Interface) *manager
func NewScheduleCache ¶
func NewScheduleCache() *scheduleCache
func OrinIDFromResourceName ¶
func Parallelize ¶
Types ¶
type Allocator ¶
type Allocator interface {
Allocate(canAlloc topo.BoardDetails, orinRequest sets.Int) *AllocatorResult
}
type AllocatorResult ¶
type AllocatorResult struct {
// contains filtered or unexported fields
}
type BinpackAllocator ¶
type BinpackAllocator struct{}
func (*BinpackAllocator) Allocate ¶
func (ba *BinpackAllocator) Allocate(canAlloc topo.BoardDetails, orinRequest sets.Int) *AllocatorResult
type Cache ¶
type Cache interface { // pod cache will be updated by two way, one is Bind() method, the other is // pod informer call back handler // AddPod add a pod to cache which we focus on AddPod(pod *v1.Pod) error // DeletePod add a pod to cache which we focus on DeletePod(pod *v1.Pod) error KnownPod(pod *v1.Pod) bool // node cache will be updated by node informer call back handler // AddNode add a node to cache AddNode(node *v1.Node, pods ...*v1.Pod) error // UpdateNode update a node in cache, when device-plugin check orin device offline // it will be update board and orin extend resources GetNode(name string) *NodeInfo UpdateNode(oldNode *v1.Node, newNode *v1.Node, pods ...*v1.Pod) error // DeleteNode delete a node to cache DeleteNode(node *v1.Node) error // AssumePod will add pod to tmp cache AssumePod(pod *v1.Pod, node string) error // ForgetPod will clear assume cache, like bind error ForgetPod(pod *v1.Pod, node string) error }
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(clientset kubernetes.Interface, manager Manager, stopCh <-chan struct{}) (c *Controller, err error)
func (*Controller) Run ¶
func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error
Run will set up the event handlers
type DecimalMap ¶
type DecimalMap struct {
// contains filtered or unexported fields
}
func NewDecimalMap ¶
func NewDecimalMap(src int64, startBit int) *DecimalMap
type Manager ¶
type Manager interface { // Predicate check node if has sufficent device resource to allocate Predicate(nodes []string, pod *v1.Pod) ([]string, map[string]string, error) // Priority score node for place current pod device resource request Priority(node []string, pod *v1.Pod) []int // Bind will update pod annotaion and update local cache Bind(node string, name, namespace string, podUID types.UID) error // GetPodFromApiserver use clientset to get newest pod info, instead localcache GetPodFromApiserver(podName, podNamespace string, podUID types.UID) (*v1.Pod, error) Cache }
type NodeInfo ¶
type NodeInfo struct { // Overall node information. Node *v1.Node // Pods running on the node. Pods map[types.UID]*v1.Pod // Requested is orin device num Allocatable topo.BoardDetails Requested topo.BoardDetails Total topo.BoardDetails }
type SpreadAllocator ¶
type SpreadAllocator struct{}
func (*SpreadAllocator) Allocate ¶
func (sa *SpreadAllocator) Allocate(canAlloc topo.BoardDetails, orinRequest sets.Int) *AllocatorResult
TODO implement
Source Files ¶
Click to show internal directories.
Click to hide internal directories.