Documentation ¶
Index ¶
- Constants
- func CreateNodeNameToInfoMap(pods []*v1.Pod, nodes []*v1.Node) map[string]*NodeInfo
- func GetPodAnnotationsPoolName(pod *v1.Pod) string
- func GetPodKey(pod *v1.Pod) (string, error)
- func SliceContainsString(slice []string, s string) bool
- type HostPortInfo
- type ImageStateSummary
- type NodeInfo
- func (n *NodeInfo) AddPod(pod *v1.Pod)
- func (n *NodeInfo) AllocatableResource() Resource
- func (n *NodeInfo) AllowedPodNumber() int
- func (n *NodeInfo) Clone() *NodeInfo
- func (n *NodeInfo) DiskPressureCondition() v1.ConditionStatus
- func (n *NodeInfo) Filter(pod *v1.Pod) bool
- func (n *NodeInfo) FilterOutPods(pods []*v1.Pod) []*v1.Pod
- func (n *NodeInfo) GetGeneration() int64
- func (n *NodeInfo) ImageStates() map[string]*ImageStateSummary
- func (n *NodeInfo) MemoryPressureCondition() v1.ConditionStatus
- func (n *NodeInfo) Node() *v1.Node
- func (n *NodeInfo) NonZeroRequest() Resource
- func (n *NodeInfo) PIDPressureCondition() v1.ConditionStatus
- func (n *NodeInfo) Pods() []*v1.Pod
- func (n *NodeInfo) PodsWithAffinity() []*v1.Pod
- func (n *NodeInfo) RemoveNode(node *v1.Node) error
- func (n *NodeInfo) RemovePod(pod *v1.Pod) error
- func (n *NodeInfo) RequestedResource() Resource
- func (n *NodeInfo) SetAllocatableResource(allocatableResource *Resource)
- func (n *NodeInfo) SetGeneration(newGeneration int64)
- func (n *NodeInfo) SetImageStates(newImageStates map[string]*ImageStateSummary)
- func (n *NodeInfo) SetNode(node *v1.Node) error
- func (n *NodeInfo) SetNonZeroRequest(newResource *Resource)
- func (n *NodeInfo) SetPods(pods []*v1.Pod)
- func (n *NodeInfo) SetRequestedResource(newResource *Resource)
- func (n *NodeInfo) SetTaints(newTaints []v1.Taint)
- func (n *NodeInfo) SetUsedPorts(newUsedPorts HostPortInfo)
- func (n *NodeInfo) String() string
- func (n *NodeInfo) Taints() ([]v1.Taint, error)
- func (n *NodeInfo) UpdateUsedPorts(pod *v1.Pod, add bool)
- func (n *NodeInfo) UsedPorts() HostPortInfo
- func (n *NodeInfo) VolumeLimits() map[v1.ResourceName]int64
- type NodeInfoListItem
- type NodeInfoSnapshot
- type NodeTree
- type PoolInfo
- func (p *PoolInfo) AddNode(node *v1.Node) error
- func (p *PoolInfo) AddNodeInfo(item *NodeInfoListItem) error
- func (p *PoolInfo) AddPod(pod *v1.Pod) error
- func (p *PoolInfo) Allocatable() *Resource
- func (p *PoolInfo) CanBorrowPool(pool *PoolInfo) bool
- func (p *PoolInfo) Capacity() *Resource
- func (p *PoolInfo) ClearPool()
- func (p *PoolInfo) ContainsNode(nodeName string) (*NodeInfoListItem, bool)
- func (p *PoolInfo) DisableBorrowing() bool
- func (p *PoolInfo) DisablePreemption() bool
- func (p *PoolInfo) DisableSharing() bool
- func (p *PoolInfo) GetPool() *v1alpha1.Pool
- func (p *PoolInfo) HeadNode() *NodeInfoListItem
- func (p *PoolInfo) Idle() *Resource
- func (p *PoolInfo) IsDefaultPool() bool
- func (p *PoolInfo) MatchNode(node *v1.Node) bool
- func (p *PoolInfo) MatchPod(pod *v1.Pod) bool
- func (p *PoolInfo) Name() string
- func (p *PoolInfo) NeedMatchNodeLabel() bool
- func (p *PoolInfo) NodeInfoSnapshot() *NodeInfoSnapshot
- func (p *PoolInfo) NodeTree() *NodeTree
- func (p *PoolInfo) Nodes() map[string]*NodeInfoListItem
- func (p *PoolInfo) NumNodes() int
- func (p *PoolInfo) RemoveNode(node *v1.Node) error
- func (p *PoolInfo) RemoveNodeInfo(item *NodeInfoListItem) error
- func (p *PoolInfo) RemovePod(pod *v1.Pod) error
- func (p *PoolInfo) SetAllocatable(resource *Resource)
- func (p *PoolInfo) SetAllocatableResource(name v1.ResourceName, value int64)
- func (p *PoolInfo) SetPool(pool *v1alpha1.Pool) error
- func (p *PoolInfo) SetShared(resource *Resource)
- func (p *PoolInfo) SetUsed(resource *Resource)
- func (p *PoolInfo) Shared() *Resource
- func (p *PoolInfo) String() string
- func (p *PoolInfo) UpdateNode(oldNode, newNode *v1.Node) error
- func (p *PoolInfo) UpdateNodeInfoSnapshot() error
- func (p *PoolInfo) UpdatePod(oldPod, newPod *v1.Pod) error
- func (p *PoolInfo) Used() *Resource
- type ProtocolPort
- type Resource
- func (r *Resource) Add(rl v1.ResourceList)
- func (r *Resource) AddScalar(name v1.ResourceName, quantity int64)
- func (r *Resource) Clone() *Resource
- func (r *Resource) GetValue(name v1.ResourceName) int64
- func (r *Resource) LessOrEqual(rr *Resource) bool
- func (r *Resource) Plus(rr *Resource) *Resource
- func (r *Resource) ResourceList() v1.ResourceList
- func (r *Resource) ResourceNames() []v1.ResourceName
- func (r *Resource) SetMaxResource(rl v1.ResourceList)
- func (r *Resource) SetScalar(name v1.ResourceName, quantity int64)
- func (r *Resource) SetValue(name v1.ResourceName, value int64)
- func (r *Resource) Sub(rr *Resource) *Resource
- type Snapshot
- type TransientSchedulerInfo
Constants ¶
const ( // ResourceGPU need to follow https://github.com/NVIDIA/k8s-device-plugin/blob/66a35b71ac4b5cbfb04714678b548bd77e5ba719/server.go#L20 ResourceGPU = "nvidia.com/gpu" // DefaultPool name of Default pool, DefaultPool collect all pods not belong // to any pools. DefaultPoolName = "" )
const DefaultBindAllHostIP = "0.0.0.0"
DefaultBindAllHostIP defines the default ip address used to bind to all host.
Variables ¶
This section is empty.
Functions ¶
func CreateNodeNameToInfoMap ¶
CreateNodeNameToInfoMap obtains a list of pods and pivots that list into a map where the keys are node names and the values are the aggregated information for that node.
func SliceContainsString ¶ added in v0.3.0
Types ¶
type HostPortInfo ¶
type HostPortInfo map[string]map[ProtocolPort]struct{}
HostPortInfo stores mapping from ip to a set of ProtocolPort
func (HostPortInfo) Add ¶
func (h HostPortInfo) Add(ip, protocol string, port int32)
Add adds (ip, protocol, port) to HostPortInfo
func (HostPortInfo) CheckConflict ¶
func (h HostPortInfo) CheckConflict(ip, protocol string, port int32) bool
CheckConflict checks if the input (ip, protocol, port) conflicts with the existing ones in HostPortInfo.
func (HostPortInfo) Len ¶
func (h HostPortInfo) Len() int
Len returns the total number of (ip, protocol, port) tuple in HostPortInfo
func (HostPortInfo) Remove ¶
func (h HostPortInfo) Remove(ip, protocol string, port int32)
Remove removes (ip, protocol, port) from HostPortInfo
type ImageStateSummary ¶
type ImageStateSummary struct { // Size of the image Size int64 // Used to track how many nodes have this image NumNodes int }
ImageStateSummary provides summarized information about the state of an image.
type NodeInfo ¶
type NodeInfo struct { // TransientInfo holds the information pertaining to a scheduling cycle. This will be destructed at the end of // scheduling cycle. // TODO: @ravig. Remove this once we have a clear approach for message passing across predicates and priorities. TransientInfo *TransientSchedulerInfo // contains filtered or unexported fields }
NodeInfo is node level aggregated information.
func NewNodeInfo ¶
NewNodeInfo returns a ready to use empty NodeInfo object. If any pods are given in arguments, their information will be aggregated in the returned object.
func (*NodeInfo) AllocatableResource ¶
AllocatableResource returns allocatable resources on a given node.
func (*NodeInfo) AllowedPodNumber ¶
AllowedPodNumber returns the number of the allowed pods on this node.
func (*NodeInfo) DiskPressureCondition ¶
func (n *NodeInfo) DiskPressureCondition() v1.ConditionStatus
DiskPressureCondition returns the disk pressure condition status on this node.
func (*NodeInfo) Filter ¶
Filter implements PodFilter interface. It returns false only if the pod node name matches NodeInfo.node and the pod is not found in the pods list. Otherwise, returns true.
func (*NodeInfo) FilterOutPods ¶
FilterOutPods receives a list of pods and filters out those whose node names are equal to the node of this NodeInfo, but are not found in the pods of this NodeInfo.
Preemption logic simulates removal of pods on a node by removing them from the corresponding NodeInfo. In order for the simulation to work, we call this method on the pods returned from SchedulerCache, so that predicate functions see only the pods that are not removed from the NodeInfo.
func (*NodeInfo) GetGeneration ¶
GetGeneration returns the generation on this node.
func (*NodeInfo) ImageStates ¶
func (n *NodeInfo) ImageStates() map[string]*ImageStateSummary
ImageStates returns the state information of all images.
func (*NodeInfo) MemoryPressureCondition ¶
func (n *NodeInfo) MemoryPressureCondition() v1.ConditionStatus
MemoryPressureCondition returns the memory pressure condition status on this node.
func (*NodeInfo) NonZeroRequest ¶
NonZeroRequest returns aggregated nonzero resource request of pods on this node.
func (*NodeInfo) PIDPressureCondition ¶
func (n *NodeInfo) PIDPressureCondition() v1.ConditionStatus
PIDPressureCondition returns the pid pressure condition status on this node.
func (*NodeInfo) PodsWithAffinity ¶
PodsWithAffinity return all pods with (anti)affinity constraints on this node.
func (*NodeInfo) RemoveNode ¶
RemoveNode removes the overall information about the node.
func (*NodeInfo) RequestedResource ¶
RequestedResource returns aggregated resource request of pods on this node.
func (*NodeInfo) SetAllocatableResource ¶
SetAllocatableResource sets the allocatableResource information of given node.
func (*NodeInfo) SetGeneration ¶
SetGeneration sets the generation on this node. This is for testing only.
func (*NodeInfo) SetImageStates ¶
func (n *NodeInfo) SetImageStates(newImageStates map[string]*ImageStateSummary)
SetImageStates sets the state information of all images.
func (*NodeInfo) SetNonZeroRequest ¶
SetNonZeroRequest sets the aggregated nonzero resource request of pods on this node.
func (*NodeInfo) SetRequestedResource ¶
SetRequestedResource sets the aggregated resource request of pods on this node.
func (*NodeInfo) SetUsedPorts ¶
func (n *NodeInfo) SetUsedPorts(newUsedPorts HostPortInfo)
SetUsedPorts sets the used ports on this node.
func (*NodeInfo) UpdateUsedPorts ¶
UpdateUsedPorts updates the UsedPorts of NodeInfo.
func (*NodeInfo) UsedPorts ¶
func (n *NodeInfo) UsedPorts() HostPortInfo
UsedPorts returns used ports on this node.
func (*NodeInfo) VolumeLimits ¶
func (n *NodeInfo) VolumeLimits() map[v1.ResourceName]int64
VolumeLimits returns volume limits associated with the node
type NodeInfoListItem ¶
type NodeInfoListItem struct {
// contains filtered or unexported fields
}
nodeInfoListItem holds a NodeInfo pointer and acts as an item in a doubly linked list. When a NodeInfo is updated, it goes to the head of the list. The items closer to the head are the most recently updated items.
func (*NodeInfoListItem) Info ¶
func (n *NodeInfoListItem) Info() *NodeInfo
func (*NodeInfoListItem) Next ¶
func (n *NodeInfoListItem) Next() *NodeInfoListItem
func (*NodeInfoListItem) Prev ¶
func (n *NodeInfoListItem) Prev() *NodeInfoListItem
type NodeInfoSnapshot ¶
NodeInfoSnapshot is a snapshot of cache NodeInfo. The scheduler takes a snapshot at the beginning of each scheduling cycle and uses it for its operations in that cycle.
func NewNodeInfoSnapshot ¶
func NewNodeInfoSnapshot() *NodeInfoSnapshot
func (*NodeInfoSnapshot) Nodes ¶ added in v0.2.0
func (ns *NodeInfoSnapshot) Nodes() []*v1.Node
type NodeTree ¶
type NodeTree struct {
// contains filtered or unexported fields
}
NodeTree is a tree-like data structure that holds node names in each zone. Zone names are keys to "NodeTree.tree" and values of "NodeTree.tree" are arrays of node names.
func (*NodeTree) AddNode ¶
AddNode adds a node and its corresponding zone to the tree. If the zone already exists, the node is added to the array of nodes in that zone.
func (*NodeTree) Next ¶
Next returns the name of the next node. NodeTree iterates over zones and in each zone iterates over nodes in a round robin fashion.
func (*NodeTree) RemoveNode ¶
RemoveNode removes a node from the NodeTree.
func (*NodeTree) UpdateNode ¶
UpdateNode updates a node in the NodeTree.
type PoolInfo ¶
type PoolInfo struct {
// contains filtered or unexported fields
}
func NewPoolInfo ¶
func NewPoolInfo() *PoolInfo
func (*PoolInfo) AddNodeInfo ¶
func (p *PoolInfo) AddNodeInfo(item *NodeInfoListItem) error
AddNode add node to tool, and compute all resources value
func (*PoolInfo) Allocatable ¶
func (*PoolInfo) CanBorrowPool ¶ added in v0.3.0
func (*PoolInfo) ClearPool ¶
func (p *PoolInfo) ClearPool()
RemovePool removes the overall information about the pool
func (*PoolInfo) ContainsNode ¶
func (p *PoolInfo) ContainsNode(nodeName string) (*NodeInfoListItem, bool)
func (*PoolInfo) DisableBorrowing ¶
func (*PoolInfo) DisablePreemption ¶
func (*PoolInfo) DisableSharing ¶
func (*PoolInfo) HeadNode ¶
func (p *PoolInfo) HeadNode() *NodeInfoListItem
func (*PoolInfo) IsDefaultPool ¶
func (*PoolInfo) NeedMatchNodeLabel ¶
func (*PoolInfo) NodeInfoSnapshot ¶
func (p *PoolInfo) NodeInfoSnapshot() *NodeInfoSnapshot
not add lock
func (*PoolInfo) Nodes ¶
func (p *PoolInfo) Nodes() map[string]*NodeInfoListItem
func (*PoolInfo) RemoveNodeInfo ¶
func (p *PoolInfo) RemoveNodeInfo(item *NodeInfoListItem) error
RemoveNode remove node from pool
func (*PoolInfo) SetAllocatable ¶
func (*PoolInfo) SetAllocatableResource ¶
func (p *PoolInfo) SetAllocatableResource(name v1.ResourceName, value int64)
func (*PoolInfo) UpdateNodeInfoSnapshot ¶
type ProtocolPort ¶
ProtocolPort represents a protocol port pair, e.g. tcp:80.
func NewProtocolPort ¶
func NewProtocolPort(protocol string, port int32) *ProtocolPort
NewProtocolPort creates a ProtocolPort instance.
type Resource ¶
type Resource struct { MilliCPU int64 Memory int64 EphemeralStorage int64 // We store allowedPodNumber (which is Node.Status.Allocatable.Pods().Value()) // explicitly as int, to avoid conversions and improve performance. AllowedPodNumber int // ScalarResources ScalarResources map[v1.ResourceName]int64 }
Resource is a collection of compute resource.
func GetResourceRequestForPool ¶
GetResourceRequestForPool
func NewResource ¶
func NewResource(rl v1.ResourceList) *Resource
NewResource creates a Resource from ResourceList
func (*Resource) Add ¶
func (r *Resource) Add(rl v1.ResourceList)
Add adds ResourceList into Resource.
func (*Resource) AddScalar ¶
func (r *Resource) AddScalar(name v1.ResourceName, quantity int64)
AddScalar adds a resource by a scalar value of this resource.
func (*Resource) LessOrEqual ¶
Less checks whether a resource is less than other
func (*Resource) ResourceList ¶
func (r *Resource) ResourceList() v1.ResourceList
ResourceList returns a resource list of this resource.
func (*Resource) ResourceNames ¶
func (r *Resource) ResourceNames() []v1.ResourceName
ResourceNames returns all resource types
func (*Resource) SetMaxResource ¶
func (r *Resource) SetMaxResource(rl v1.ResourceList)
SetMaxResource compares with ResourceList and takes max value for each Resource.
type TransientSchedulerInfo ¶
type TransientSchedulerInfo struct { TransientLock sync.Mutex // NodeTransInfo holds the information related to nodeTransientInformation. NodeName is the key here. TransNodeInfo nodeTransientInfo }
TransientSchedulerInfo is a transient structure which is destructed at the end of each scheduling cycle. It consists of items that are valid for a scheduling cycle and is used for message passing across predicates and priorities. Some examples which could be used as fields are number of volumes being used on node, current utilization on node etc. IMPORTANT NOTE: Make sure that each field in this structure is documented along with usage. Expand this structure only when absolutely needed as this data structure will be created and destroyed during every scheduling cycle.
func NewTransientSchedulerInfo ¶
func NewTransientSchedulerInfo() *TransientSchedulerInfo
NewTransientSchedulerInfo returns a new scheduler transient structure with initialized values.
func (*TransientSchedulerInfo) ResetTransientSchedulerInfo ¶
func (transientSchedInfo *TransientSchedulerInfo) ResetTransientSchedulerInfo()
ResetTransientSchedulerInfo resets the TransientSchedulerInfo.