v1.18.20 Latest Latest

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

Go to latest
Published: Jun 16, 2021 License: Apache-2.0 Imports: 11 Imported by: 0




View Source
const DefaultBindAllHostIP = ""

DefaultBindAllHostIP defines the default ip address used to bind to all host.


This section is empty.


func GetPodKey

func GetPodKey(pod *v1.Pod) (string, error)

GetPodKey returns the string key of a pod.


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

func NewNodeInfo(pods ...*v1.Pod) *NodeInfo

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) AddPod

func (n *NodeInfo) AddPod(pod *v1.Pod)

AddPod adds pod information to this NodeInfo.

func (*NodeInfo) AllocatableResource

func (n *NodeInfo) AllocatableResource() Resource

AllocatableResource returns allocatable resources on a given node.

func (*NodeInfo) AllowedPodNumber

func (n *NodeInfo) AllowedPodNumber() int

AllowedPodNumber returns the number of the allowed pods on this node.

func (*NodeInfo) Clone

func (n *NodeInfo) Clone() *NodeInfo

Clone returns a copy of this node.

func (*NodeInfo) Filter

func (n *NodeInfo) Filter(pod *v1.Pod) bool

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

func (n *NodeInfo) FilterOutPods(pods []*v1.Pod) []*v1.Pod

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

func (n *NodeInfo) GetGeneration() int64

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) Node

func (n *NodeInfo) Node() *v1.Node

Node returns overall information about this node.

func (*NodeInfo) NonZeroRequest

func (n *NodeInfo) NonZeroRequest() Resource

NonZeroRequest returns aggregated nonzero resource request of pods on this node.

func (*NodeInfo) Pods

func (n *NodeInfo) Pods() []*v1.Pod

Pods return all pods scheduled (including assumed to be) on this node.

func (*NodeInfo) PodsWithAffinity

func (n *NodeInfo) PodsWithAffinity() []*v1.Pod

PodsWithAffinity return all pods with (anti)affinity constraints on this node.

func (*NodeInfo) PodsWithRequiredAntiAffinity added in v1.18.10

func (n *NodeInfo) PodsWithRequiredAntiAffinity() []*v1.Pod

PodsWithRequiredAntiAffinity return all pods with required anti-affinity constraints on this node.

func (*NodeInfo) RemoveNode

func (n *NodeInfo) RemoveNode()

RemoveNode removes the node object, leaving all other tracking information.

func (*NodeInfo) RemovePod

func (n *NodeInfo) RemovePod(pod *v1.Pod) error

RemovePod subtracts pod information from this NodeInfo.

func (*NodeInfo) RequestedResource

func (n *NodeInfo) RequestedResource() Resource

RequestedResource returns aggregated resource request of pods on this node.

func (*NodeInfo) SetAllocatableResource

func (n *NodeInfo) SetAllocatableResource(allocatableResource *Resource)

SetAllocatableResource sets the allocatableResource information of given node.

func (*NodeInfo) SetGeneration

func (n *NodeInfo) SetGeneration(newGeneration int64)

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) SetNode

func (n *NodeInfo) SetNode(node *v1.Node) error

SetNode sets the overall node information.

func (*NodeInfo) SetNonZeroRequest

func (n *NodeInfo) SetNonZeroRequest(newResource *Resource)

SetNonZeroRequest sets the aggregated nonzero resource request of pods on this node.

func (*NodeInfo) SetPods

func (n *NodeInfo) SetPods(pods []*v1.Pod)

SetPods sets all pods scheduled (including assumed to be) on this node.

func (*NodeInfo) SetRequestedResource

func (n *NodeInfo) SetRequestedResource(newResource *Resource)

SetRequestedResource sets the aggregated resource request of pods on this node.

func (*NodeInfo) SetTaints

func (n *NodeInfo) SetTaints(newTaints []v1.Taint)

SetTaints sets the taints list on this node.

func (*NodeInfo) SetUsedPorts

func (n *NodeInfo) SetUsedPorts(newUsedPorts HostPortInfo)

SetUsedPorts sets the used ports on this node.

func (*NodeInfo) String

func (n *NodeInfo) String() string

String returns representation of human readable format of this NodeInfo.

func (*NodeInfo) Taints

func (n *NodeInfo) Taints() ([]v1.Taint, error)

Taints returns the taints list on this node.

func (*NodeInfo) UpdateUsedPorts

func (n *NodeInfo) UpdateUsedPorts(pod *v1.Pod, add bool)

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 ProtocolPort

type ProtocolPort struct {
	Protocol string
	Port     int32

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 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) Clone

func (r *Resource) Clone() *Resource

Clone returns a copy of this resource.

func (*Resource) ResourceList

func (r *Resource) ResourceList() v1.ResourceList

ResourceList returns a resource list of this resource.

func (*Resource) SetMaxResource

func (r *Resource) SetMaxResource(rl v1.ResourceList)

SetMaxResource compares with ResourceList and takes max value for each Resource.

func (*Resource) SetScalar

func (r *Resource) SetScalar(name v1.ResourceName, quantity int64)

SetScalar sets a resource by a scalar value of this 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.

Jump to

Keyboard shortcuts

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