kubernetes: k8s.io/kubernetes/pkg/scheduler/nodeinfo Index | Files | Directories

package nodeinfo

import "k8s.io/kubernetes/pkg/scheduler/nodeinfo"


Package Files

host_ports.go node_info.go


const DefaultBindAllHostIP = ""

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

func GetPodKey Uses

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

GetPodKey returns the string key of a pod.

type HostPortInfo Uses

type HostPortInfo map[string]map[ProtocolPort]struct{}

HostPortInfo stores mapping from ip to a set of ProtocolPort

func (HostPortInfo) Add Uses

func (h HostPortInfo) Add(ip, protocol string, port int32)

Add adds (ip, protocol, port) to HostPortInfo

func (HostPortInfo) CheckConflict Uses

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 Uses

func (h HostPortInfo) Len() int

Len returns the total number of (ip, protocol, port) tuple in HostPortInfo

func (HostPortInfo) Remove Uses

func (h HostPortInfo) Remove(ip, protocol string, port int32)

Remove removes (ip, protocol, port) from HostPortInfo

type ImageStateSummary Uses

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 Uses

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 Uses

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 Uses

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

AddPod adds pod information to this NodeInfo.

func (*NodeInfo) AllocatableResource Uses

func (n *NodeInfo) AllocatableResource() Resource

AllocatableResource returns allocatable resources on a given node.

func (*NodeInfo) AllowedPodNumber Uses

func (n *NodeInfo) AllowedPodNumber() int

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

func (*NodeInfo) Clone Uses

func (n *NodeInfo) Clone() *NodeInfo

Clone returns a copy of this node.

func (*NodeInfo) Filter Uses

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 Uses

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 Uses

func (n *NodeInfo) GetGeneration() int64

GetGeneration returns the generation on this node.

func (*NodeInfo) ImageStates Uses

func (n *NodeInfo) ImageStates() map[string]*ImageStateSummary

ImageStates returns the state information of all images.

func (*NodeInfo) Node Uses

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

Node returns overall information about this node.

func (*NodeInfo) NonZeroRequest Uses

func (n *NodeInfo) NonZeroRequest() Resource

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

func (*NodeInfo) Pods Uses

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

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

func (*NodeInfo) PodsWithAffinity Uses

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

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

func (*NodeInfo) RemovePod Uses

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

RemovePod subtracts pod information from this NodeInfo.

func (*NodeInfo) RequestedResource Uses

func (n *NodeInfo) RequestedResource() Resource

RequestedResource returns aggregated resource request of pods on this node.

func (*NodeInfo) SetAllocatableResource Uses

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

SetAllocatableResource sets the allocatableResource information of given node.

func (*NodeInfo) SetGeneration Uses

func (n *NodeInfo) SetGeneration(newGeneration int64)

SetGeneration sets the generation on this node. This is for testing only.

func (*NodeInfo) SetImageStates Uses

func (n *NodeInfo) SetImageStates(newImageStates map[string]*ImageStateSummary)

SetImageStates sets the state information of all images.

func (*NodeInfo) SetNode Uses

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

SetNode sets the overall node information.

func (*NodeInfo) SetNonZeroRequest Uses

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

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

func (*NodeInfo) SetPods Uses

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

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

func (*NodeInfo) SetRequestedResource Uses

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

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

func (*NodeInfo) SetTaints Uses

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

SetTaints sets the taints list on this node.

func (*NodeInfo) SetUsedPorts Uses

func (n *NodeInfo) SetUsedPorts(newUsedPorts HostPortInfo)

SetUsedPorts sets the used ports on this node.

func (*NodeInfo) String Uses

func (n *NodeInfo) String() string

String returns representation of human readable format of this NodeInfo.

func (*NodeInfo) Taints Uses

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

Taints returns the taints list on this node.

func (*NodeInfo) UpdateUsedPorts Uses

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

UpdateUsedPorts updates the UsedPorts of NodeInfo.

func (*NodeInfo) UsedPorts Uses

func (n *NodeInfo) UsedPorts() HostPortInfo

UsedPorts returns used ports on this node.

func (*NodeInfo) VolumeLimits Uses

func (n *NodeInfo) VolumeLimits() map[v1.ResourceName]int64

VolumeLimits returns volume limits associated with the node

type ProtocolPort Uses

type ProtocolPort struct {
    Protocol string
    Port     int32

ProtocolPort represents a protocol port pair, e.g. tcp:80.

func NewProtocolPort Uses

func NewProtocolPort(protocol string, port int32) *ProtocolPort

NewProtocolPort creates a ProtocolPort instance.

type Resource Uses

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 Uses

func NewResource(rl v1.ResourceList) *Resource

NewResource creates a Resource from ResourceList

func (*Resource) Add Uses

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

Add adds ResourceList into Resource.

func (*Resource) AddScalar Uses

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

AddScalar adds a resource by a scalar value of this resource.

func (*Resource) Clone Uses

func (r *Resource) Clone() *Resource

Clone returns a copy of this resource.

func (*Resource) ResourceList Uses

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

ResourceList returns a resource list of this resource.

func (*Resource) SetMaxResource Uses

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

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

func (*Resource) SetScalar Uses

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

SetScalar sets a resource by a scalar value of this resource.

type TransientSchedulerInfo Uses

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 Uses

func NewTransientSchedulerInfo() *TransientSchedulerInfo

NewTransientSchedulerInfo returns a new scheduler transient structure with initialized values.

func (*TransientSchedulerInfo) ResetTransientSchedulerInfo Uses

func (transientSchedInfo *TransientSchedulerInfo) ResetTransientSchedulerInfo()

ResetTransientSchedulerInfo resets the TransientSchedulerInfo.



Package nodeinfo imports 11 packages (graph) and is imported by 302 packages. Updated 2020-01-22. Refresh now. Tools for package owners.