Documentation
¶
Index ¶
- Constants
- func IsCordonTaint(taint v1.Taint) bool
- func MarkAllocatable(m map[int32]ResourceList, p int32, rs ResourceList)
- func MarkAllocated(m map[int32]ResourceList, p int32, rs ResourceList)
- func NewAllocatableByPriorityAndResourceType(priorities []int32, rl ResourceList) map[int32]ResourceList
- func QuantityToInt64RoundDown(q resource.Quantity, scale resource.Scale) int64
- func QuantityToInt64RoundUp(q resource.Quantity, scale resource.Scale) int64
- func RlMapAllZero(m map[string]ResourceList) bool
- func RlMapHasNegativeValues(m map[string]ResourceList) bool
- func RlMapRemoveZeros(m map[string]ResourceList) map[string]ResourceList
- func RlMapToString(m map[string]ResourceList) string
- func ToSchedulerObjectsJobSchedulingInfo(j *JobSchedulingInfo) *schedulerobjects.JobSchedulingInfo
- func UnschedulableTaint() v1.Taint
- type JobSchedulingInfo
- type Node
- func CreateNode(id string, nodeType *NodeType, index uint64, executor string, name string, ...) *Node
- func CreateNodeAndType(id string, index uint64, executor string, name string, pool string, ...) *Node
- func FromSchedulerObjectsNode(node *schedulerobjects.Node, nodeIndex uint64, indexedTaints map[string]bool, ...) *Node
- func (node *Node) DeepCopyNilKeys() *Node
- func (node *Node) FindMatchingUntoleratedTaint(tolerations ...[]v1.Toleration) (v1.Taint, bool)
- func (node *Node) GetAllocatableResources() ResourceList
- func (node *Node) GetExecutor() string
- func (node *Node) GetId() string
- func (node *Node) GetIndex() uint64
- func (node *Node) GetLabelValue(key string) (string, bool)
- func (node *Node) GetLabels() map[string]string
- func (node *Node) GetName() string
- func (node *Node) GetNodeType() *NodeType
- func (node *Node) GetNodeTypeId() uint64
- func (node *Node) GetPool() string
- func (node *Node) GetReportingNodeType() string
- func (node *Node) GetReservation() string
- func (node *Node) GetRunningJobIds() []string
- func (node *Node) GetTaints() []v1.Taint
- func (node *Node) GetTolerationsForTaints() []v1.Toleration
- func (node *Node) GetTotalResources() ResourceList
- func (node *Node) IsOverAllocated() bool
- func (node *Node) IsUnschedulable() bool
- func (node *Node) MarkResourceUnallocatable(unallocatable ResourceList) *Node
- func (node *Node) MatchNodeSelectorTerms(nodeSelector *v1.NodeSelector) (bool, error)
- func (node *Node) SummaryString() string
- func (node *Node) WithOverAllocated(overAllocated bool) *Node
- func (node *Node) WithSchedulable(schedulable bool) *Node
- type NodeFactory
- func (f *NodeFactory) AddLabels(nodes []*Node, extraLabels map[string]string) []*Node
- func (f *NodeFactory) AddTaints(nodes []*Node, extraTaints []v1.Taint) []*Node
- func (f *NodeFactory) CreateNodeAndType(id string, executor string, name string, pool string, reportingNodeType string, ...) *Node
- func (f *NodeFactory) FromSchedulerObjectsExecutors(executors []*schedulerobjects.Executor, errorLogger func(string)) []*Node
- func (f *NodeFactory) FromSchedulerObjectsNode(node *schedulerobjects.Node) *Node
- func (f *NodeFactory) RemoveCordonTaint(nodes []*Node) []*Node
- func (f *NodeFactory) ResourceListFactory() *ResourceListFactory
- type NodeType
- func (m *NodeType) FindMatchingUntoleratedTaint(tolerations ...[]v1.Toleration) (v1.Taint, bool)
- func (m *NodeType) GetId() uint64
- func (m *NodeType) GetLabelValue(key string) (string, bool)
- func (m *NodeType) GetLabels() map[string]string
- func (m *NodeType) GetTaints() []v1.Taint
- func (m *NodeType) GetUnsetIndexedLabelValue(key string) (string, bool)
- func (m *NodeType) GetUnsetIndexedLabels() map[string]string
- type PodRequirements
- type PodRequirementsSerialiser
- func (skg *PodRequirementsSerialiser) AppendAffinity(out []byte, affinity *v1.Affinity) []byte
- func (skg *PodRequirementsSerialiser) AppendAffinityNodeSelector(out []byte, nodeSelector *v1.NodeSelector) []byte
- func (skg *PodRequirementsSerialiser) AppendNodeSelector(out []byte, nodeSelector map[string]string) []byte
- func (skg *PodRequirementsSerialiser) AppendNodeSelectorRequirements(out []byte, nodeSelectorRequirements []v1.NodeSelectorRequirement) []byte
- func (skg *PodRequirementsSerialiser) AppendRequirements(out []byte, nodeSelector map[string]string, affinity *v1.Affinity, ...) []byte
- func (skg *PodRequirementsSerialiser) AppendResourceList(out []byte, resourceList v1.ResourceList) []byte
- func (skg *PodRequirementsSerialiser) AppendTolerations(out []byte, tolerations []v1.Toleration) []byte
- type Resource
- type ResourceFractionList
- type ResourceList
- func (rl ResourceList) Add(other ResourceList) ResourceList
- func (rl ResourceList) AllZero() bool
- func (rl ResourceList) Cap(cap ResourceList) ResourceList
- func (rl ResourceList) DivideZeroOnError(other ResourceList) ResourceFractionList
- func (rl ResourceList) Equal(other ResourceList) bool
- func (rl ResourceList) Exceeds(other ResourceList) bool
- func (rl ResourceList) ExceedsAvailable(available ResourceList) (string, k8sResource.Quantity, k8sResource.Quantity, bool)
- func (rl ResourceList) Factory() *ResourceListFactory
- func (rl ResourceList) FloorAtZero() ResourceList
- func (rl ResourceList) GetAll() []Resource
- func (rl ResourceList) GetByNameZeroIfMissing(name string) k8sResource.Quantity
- func (rl ResourceList) GetRawByName(name string) (int64, error)
- func (rl ResourceList) GetRawByNameZeroIfMissing(name string) int64
- func (rl ResourceList) HasNegativeValues() bool
- func (rl ResourceList) IsEmpty() bool
- func (rl ResourceList) Multiply(multipliers ResourceFractionList) ResourceList
- func (rl ResourceList) Negate() ResourceList
- func (rl ResourceList) OfType(t ResourceType) ResourceList
- func (rl ResourceList) String() string
- func (rl ResourceList) Subtract(other ResourceList) ResourceList
- func (rl ResourceList) ToMap() map[string]k8sResource.Quantity
- type ResourceListFactory
- func (factory *ResourceListFactory) FromJobResourceListFailOnUnknown(resources map[string]k8sResource.Quantity) (ResourceList, error)
- func (factory *ResourceListFactory) FromJobResourceListIgnoreUnknown(resources map[string]k8sResource.Quantity) ResourceList
- func (factory *ResourceListFactory) FromNodeProto(resources map[string]*k8sResource.Quantity) ResourceList
- func (factory *ResourceListFactory) GetScale(resourceTypeName string) (k8sResource.Scale, error)
- func (factory *ResourceListFactory) MakeAllMax() ResourceList
- func (factory *ResourceListFactory) MakeAllZero() ResourceList
- func (factory *ResourceListFactory) MakeResourceFractionList(m map[string]float64, defaultValue float64) ResourceFractionList
- func (factory *ResourceListFactory) SummaryString() string
- type ResourceType
- type SchedulingKey
- type SchedulingKeyGenerator
Constants ¶
const ( // evictedPriority is the priority class priority resources consumed by evicted jobs are accounted for at. // This helps avoid scheduling new jobs onto nodes that make it impossible to re-schedule evicted jobs. EvictedPriority int32 = -1 // MinPriority is the smallest possible priority class priority within the NodeDb. MinPriority int32 = EvictedPriority )
Variables ¶
This section is empty.
Functions ¶
func IsCordonTaint ¶ added in v0.21.4
IsCordonTaint reports whether taint marks a node as cordoned, i.e. temporarily not accepting new jobs. This covers both the Armada-synthesized taint (added when a node reports unschedulable=true) and the taint Kubernetes adds automatically on `kubectl cordon` (v1.TaintNodeUnschedulable). A cordon is transient, so feasibility checks (e.g. the submit checker) should ignore these taints.
Matching is by key only, not effect. Both cordon taints are always NoSchedule in practice, and for a feasibility check any taint under these keys is transient operational state we want to ignore, so we strip it regardless of effect rather than risk rejecting a job that could run once uncordoned.
func MarkAllocatable ¶ added in v0.16.0
func MarkAllocatable(m map[int32]ResourceList, p int32, rs ResourceList)
MarkAllocatable indicates resources have been released by pods of priority p, thus increasing the resources allocatable to pods of priority p or lower.
func MarkAllocated ¶ added in v0.16.0
func MarkAllocated(m map[int32]ResourceList, p int32, rs ResourceList)
MarkAllocated indicates resources have been allocated to pods of priority p, hence reducing the resources allocatable to pods of priority p or lower.
func NewAllocatableByPriorityAndResourceType ¶ added in v0.16.0
func NewAllocatableByPriorityAndResourceType(priorities []int32, rl ResourceList) map[int32]ResourceList
func QuantityToInt64RoundDown ¶ added in v0.4.48
func QuantityToInt64RoundUp ¶ added in v0.4.48
func RlMapAllZero ¶ added in v0.15.4
func RlMapAllZero(m map[string]ResourceList) bool
func RlMapHasNegativeValues ¶ added in v0.15.4
func RlMapHasNegativeValues(m map[string]ResourceList) bool
func RlMapRemoveZeros ¶ added in v0.15.4
func RlMapRemoveZeros(m map[string]ResourceList) map[string]ResourceList
func RlMapToString ¶ added in v0.15.4
func RlMapToString(m map[string]ResourceList) string
func ToSchedulerObjectsJobSchedulingInfo ¶ added in v0.16.6
func ToSchedulerObjectsJobSchedulingInfo(j *JobSchedulingInfo) *schedulerobjects.JobSchedulingInfo
func UnschedulableTaint ¶ added in v0.13.0
UnschedulableTaint returns the taint automatically added to unschedulable nodes on inserting into the nodeDb.
Types ¶
type JobSchedulingInfo ¶ added in v0.16.6
type JobSchedulingInfo struct {
Lifetime uint32
PriorityClass string
SubmitTime time.Time
Priority uint32
PodRequirements *PodRequirements
Version uint32
}
JobSchedulingInfo is a minimal representation of job requirements that the scheduler uses for scheduling
func FromSchedulerObjectsJobSchedulingInfo ¶ added in v0.16.6
func FromSchedulerObjectsJobSchedulingInfo(j *schedulerobjects.JobSchedulingInfo) (*JobSchedulingInfo, error)
func (*JobSchedulingInfo) Annotations ¶ added in v0.19.13
func (j *JobSchedulingInfo) Annotations() map[string]string
func (*JobSchedulingInfo) DeepCopy ¶ added in v0.16.6
func (j *JobSchedulingInfo) DeepCopy() *JobSchedulingInfo
func (*JobSchedulingInfo) PriorityClassName ¶ added in v0.16.6
func (j *JobSchedulingInfo) PriorityClassName() string
type Node ¶
type Node struct {
// This field is set when inserting the Node into a NodeDb.
Keys [][]byte
AllocatableByPriority map[int32]ResourceList
AllocatedByQueue map[string]ResourceList
AllocatedByJobId map[string]ResourceList
EvictedJobRunIds map[string]bool
// contains filtered or unexported fields
}
Node is a scheduler-internal representation of one Kubernetes node. Its private fields should be immutable! Do not change these!
func CreateNode ¶ added in v0.4.37
func CreateNode( id string, nodeType *NodeType, index uint64, executor string, name string, pool string, reportingNodeType string, taints []v1.Taint, labels map[string]string, unschedulable bool, totalResources ResourceList, allocatableResources ResourceList, allocatableByPriority map[int32]ResourceList, allocatedByQueue map[string]ResourceList, allocatedByJobId map[string]ResourceList, evictedJobRunIds map[string]bool, keys [][]byte, ) *Node
func CreateNodeAndType ¶ added in v0.15.8
func CreateNodeAndType( id string, index uint64, executor string, name string, pool string, reportingNodeType string, unschedulable bool, taints []v1.Taint, labels map[string]string, indexedTaints map[string]bool, indexedNodeLabels map[string]bool, totalResources ResourceList, allocatableResources ResourceList, allocatableByPriority map[int32]ResourceList, ) *Node
func FromSchedulerObjectsNode ¶ added in v0.13.0
func FromSchedulerObjectsNode(node *schedulerobjects.Node, nodeIndex uint64, indexedTaints map[string]bool, indexedNodeLabels map[string]bool, allowedPriorities []int32, resourceListFactory *ResourceListFactory, ) *Node
func (*Node) DeepCopyNilKeys ¶ added in v0.9.0
func (*Node) FindMatchingUntoleratedTaint ¶ added in v0.4.40
func (*Node) GetAllocatableResources ¶ added in v0.16.6
func (node *Node) GetAllocatableResources() ResourceList
func (*Node) GetExecutor ¶ added in v0.4.37
func (*Node) GetLabelValue ¶ added in v0.4.40
func (*Node) GetNodeType ¶ added in v0.13.0
func (*Node) GetNodeTypeId ¶ added in v0.4.37
func (*Node) GetReportingNodeType ¶ added in v0.16.6
func (*Node) GetReservation ¶ added in v0.20.17
func (*Node) GetRunningJobIds ¶ added in v0.19.11
func (*Node) GetTolerationsForTaints ¶ added in v0.4.40
func (node *Node) GetTolerationsForTaints() []v1.Toleration
func (*Node) GetTotalResources ¶ added in v0.9.0
func (node *Node) GetTotalResources() ResourceList
func (*Node) IsOverAllocated ¶ added in v0.19.10
func (*Node) IsUnschedulable ¶ added in v0.16.6
func (*Node) MarkResourceUnallocatable ¶ added in v0.20.35
func (node *Node) MarkResourceUnallocatable(unallocatable ResourceList) *Node
func (*Node) MatchNodeSelectorTerms ¶ added in v0.4.40
func (node *Node) MatchNodeSelectorTerms(nodeSelector *v1.NodeSelector) (bool, error)
func (*Node) SummaryString ¶ added in v0.15.5
func (*Node) WithOverAllocated ¶ added in v0.19.10
func (*Node) WithSchedulable ¶ added in v0.19.10
type NodeFactory ¶ added in v0.13.1
type NodeFactory struct {
// contains filtered or unexported fields
}
func NewNodeFactory ¶ added in v0.13.1
func NewNodeFactory( indexedTaints []string, indexedNodeLabels []string, priorityClasses map[string]types.PriorityClass, resourceListFactory *ResourceListFactory, ) *NodeFactory
func (*NodeFactory) AddLabels ¶ added in v0.16.0
func (f *NodeFactory) AddLabels(nodes []*Node, extraLabels map[string]string) []*Node
func (*NodeFactory) AddTaints ¶ added in v0.16.0
func (f *NodeFactory) AddTaints(nodes []*Node, extraTaints []v1.Taint) []*Node
func (*NodeFactory) CreateNodeAndType ¶ added in v0.15.8
func (f *NodeFactory) CreateNodeAndType( id string, executor string, name string, pool string, reportingNodeType string, unschedulable bool, taints []v1.Taint, labels map[string]string, totalResources ResourceList, allocatableResources ResourceList, allocatableByPriority map[int32]ResourceList, ) *Node
func (*NodeFactory) FromSchedulerObjectsExecutors ¶ added in v0.15.5
func (f *NodeFactory) FromSchedulerObjectsExecutors(executors []*schedulerobjects.Executor, errorLogger func(string)) []*Node
func (*NodeFactory) FromSchedulerObjectsNode ¶ added in v0.13.1
func (f *NodeFactory) FromSchedulerObjectsNode(node *schedulerobjects.Node) *Node
func (*NodeFactory) RemoveCordonTaint ¶ added in v0.21.4
func (f *NodeFactory) RemoveCordonTaint(nodes []*Node) []*Node
RemoveCordonTaint returns copies of nodes with cordon taints stripped (see IsCordonTaint) and the unschedulable flag cleared. The submit checker uses it so that jobs targeting a node type whose nodes are all cordoned (via `kubectl cordon`, or otherwise reported unschedulable by the executor) stay queued rather than being rejected. See issue #4946.
A cordoned node always has the unschedulable flag set (Kubernetes only adds node.kubernetes.io/unschedulable when the node is unschedulable, and the Armada taint is only synthesized for unschedulable nodes), so the flag alone identifies the nodes to fix.
Like AddTaints/AddLabels, this rebuilds via CreateNodeAndType so NodeType (used for nodeDb indexing) is recomputed from the reduced taint set and stays consistent.
func (*NodeFactory) ResourceListFactory ¶ added in v0.16.0
func (f *NodeFactory) ResourceListFactory() *ResourceListFactory
type NodeType ¶ added in v0.9.7
type NodeType struct {
// contains filtered or unexported fields
}
NodeType represents a particular combination of taints and labels. The scheduler groups nodes by node type. When assigning pods to nodes, the scheduler only considers nodes with a NodeType for which the taints and labels match. Its fields should be immutable! Do not change these!
func NewNodeType ¶ added in v0.9.7
func (*NodeType) FindMatchingUntoleratedTaint ¶ added in v0.9.7
func (*NodeType) GetLabelValue ¶ added in v0.9.7
func (*NodeType) GetUnsetIndexedLabelValue ¶ added in v0.9.7
func (*NodeType) GetUnsetIndexedLabels ¶ added in v0.9.7
type PodRequirements ¶ added in v0.16.6
type PodRequirements struct {
NodeSelector map[string]string
Affinity *v1.Affinity
Tolerations []v1.Toleration
Annotations map[string]string
ResourceRequirements v1.ResourceRequirements
}
PodRequirements captures the scheduling requirements specific to a pod.
func (*PodRequirements) DeepCopy ¶ added in v0.16.6
func (p *PodRequirements) DeepCopy() *PodRequirements
func (*PodRequirements) GetAffinityNodeSelector ¶ added in v0.16.6
func (p *PodRequirements) GetAffinityNodeSelector() *v1.NodeSelector
type PodRequirementsSerialiser ¶ added in v0.16.6
type PodRequirementsSerialiser struct {
// contains filtered or unexported fields
}
PodRequirementsSerialiser produces the canonical byte representation of a set of pod scheduling requirements. The resulting byte array can, e.g., be used to produce a hash guaranteed to be equal for equivalent requirements. Not thread-safe.
Fields are separated by =, $, &, and =, since these characters are not allowed in taints and labels; see https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set https://man.archlinux.org/man/community/kubectl/kubectl-taint.1.en
func NewPodRequirementsSerialiser ¶ added in v0.16.6
func NewPodRequirementsSerialiser() *PodRequirementsSerialiser
func (*PodRequirementsSerialiser) AppendAffinity ¶ added in v0.16.6
func (skg *PodRequirementsSerialiser) AppendAffinity(out []byte, affinity *v1.Affinity) []byte
AppendAffinity writes a v1.Affinity into the hash. Only NodeAffinity (i.e., not PodAffinity) and RequiredDuringSchedulingIgnoredDuringExecution fields are considered.
func (*PodRequirementsSerialiser) AppendAffinityNodeSelector ¶ added in v0.16.6
func (skg *PodRequirementsSerialiser) AppendAffinityNodeSelector(out []byte, nodeSelector *v1.NodeSelector) []byte
func (*PodRequirementsSerialiser) AppendNodeSelector ¶ added in v0.16.6
func (skg *PodRequirementsSerialiser) AppendNodeSelector(out []byte, nodeSelector map[string]string) []byte
func (*PodRequirementsSerialiser) AppendNodeSelectorRequirements ¶ added in v0.16.6
func (skg *PodRequirementsSerialiser) AppendNodeSelectorRequirements(out []byte, nodeSelectorRequirements []v1.NodeSelectorRequirement) []byte
func (*PodRequirementsSerialiser) AppendRequirements ¶ added in v0.16.6
func (skg *PodRequirementsSerialiser) AppendRequirements( out []byte, nodeSelector map[string]string, affinity *v1.Affinity, tolerations []v1.Toleration, requests v1.ResourceList, priorityClassName string, ) []byte
func (*PodRequirementsSerialiser) AppendResourceList ¶ added in v0.16.6
func (skg *PodRequirementsSerialiser) AppendResourceList(out []byte, resourceList v1.ResourceList) []byte
func (*PodRequirementsSerialiser) AppendTolerations ¶ added in v0.16.6
func (skg *PodRequirementsSerialiser) AppendTolerations(out []byte, tolerations []v1.Toleration) []byte
type Resource ¶ added in v0.6.0
type Resource struct {
Name string
Value k8sResource.Quantity
Scale k8sResource.Scale
Type ResourceType
}
func (Resource) IsNegative ¶ added in v0.20.2
type ResourceFractionList ¶ added in v0.15.4
type ResourceFractionList struct {
// contains filtered or unexported fields
}
func (ResourceFractionList) GetByName ¶ added in v0.15.4
func (rfl ResourceFractionList) GetByName(name string) (float64, error)
func (ResourceFractionList) IsEmpty ¶ added in v0.15.4
func (rfl ResourceFractionList) IsEmpty() bool
func (ResourceFractionList) Max ¶ added in v0.15.4
func (rfl ResourceFractionList) Max() float64
func (ResourceFractionList) Multiply ¶ added in v0.15.4
func (rfl ResourceFractionList) Multiply(other ResourceFractionList) ResourceFractionList
type ResourceList ¶ added in v0.4.48
type ResourceList struct {
// contains filtered or unexported fields
}
func RlMapSumValues ¶ added in v0.15.4
func RlMapSumValues(m map[string]ResourceList) ResourceList
func (ResourceList) Add ¶ added in v0.6.0
func (rl ResourceList) Add(other ResourceList) ResourceList
func (ResourceList) AllZero ¶ added in v0.6.0
func (rl ResourceList) AllZero() bool
func (ResourceList) Cap ¶ added in v0.15.4
func (rl ResourceList) Cap(cap ResourceList) ResourceList
func (ResourceList) DivideZeroOnError ¶ added in v0.15.4
func (rl ResourceList) DivideZeroOnError(other ResourceList) ResourceFractionList
Divide, return 0 on attempt to divide by 0
func (ResourceList) Equal ¶ added in v0.6.0
func (rl ResourceList) Equal(other ResourceList) bool
func (ResourceList) Exceeds ¶ added in v0.15.4
func (rl ResourceList) Exceeds(other ResourceList) bool
func (ResourceList) ExceedsAvailable ¶ added in v0.6.0
func (rl ResourceList) ExceedsAvailable(available ResourceList) (string, k8sResource.Quantity, k8sResource.Quantity, bool)
ExceedsAvailable - if any resource in this ResourceList is greater than the equivalent resource in param available, this function returns
- the name of the relevant resource
- the amount of the relevant resource in available
- the amount of the relevant resource in this ResourceList
- true
- if no resources in this ResourceList exceed available, the last return value is false. - empty resource lists are considered equivalent to all zero.
func (ResourceList) Factory ¶ added in v0.15.4
func (rl ResourceList) Factory() *ResourceListFactory
func (ResourceList) FloorAtZero ¶ added in v0.14.1
func (rl ResourceList) FloorAtZero() ResourceList
func (ResourceList) GetAll ¶ added in v0.20.2
func (rl ResourceList) GetAll() []Resource
func (ResourceList) GetByNameZeroIfMissing ¶ added in v0.6.0
func (rl ResourceList) GetByNameZeroIfMissing(name string) k8sResource.Quantity
func (ResourceList) GetRawByName ¶ added in v0.20.2
func (rl ResourceList) GetRawByName(name string) (int64, error)
func (ResourceList) GetRawByNameZeroIfMissing ¶ added in v0.20.2
func (rl ResourceList) GetRawByNameZeroIfMissing(name string) int64
func (ResourceList) HasNegativeValues ¶ added in v0.6.0
func (rl ResourceList) HasNegativeValues() bool
func (ResourceList) IsEmpty ¶ added in v0.6.0
func (rl ResourceList) IsEmpty() bool
func (ResourceList) Multiply ¶ added in v0.15.4
func (rl ResourceList) Multiply(multipliers ResourceFractionList) ResourceList
func (ResourceList) Negate ¶ added in v0.6.0
func (rl ResourceList) Negate() ResourceList
func (ResourceList) OfType ¶ added in v0.14.0
func (rl ResourceList) OfType(t ResourceType) ResourceList
func (ResourceList) String ¶ added in v0.6.0
func (rl ResourceList) String() string
func (ResourceList) Subtract ¶ added in v0.6.0
func (rl ResourceList) Subtract(other ResourceList) ResourceList
func (ResourceList) ToMap ¶ added in v0.13.0
func (rl ResourceList) ToMap() map[string]k8sResource.Quantity
type ResourceListFactory ¶ added in v0.4.48
type ResourceListFactory struct {
// contains filtered or unexported fields
}
func NewResourceListFactory ¶ added in v0.13.1
func NewResourceListFactory( supportedResourceTypes []configuration.ResourceType, floatingResourceTypes []configuration.FloatingResourceConfig, ) (*ResourceListFactory, error)
func (*ResourceListFactory) FromJobResourceListFailOnUnknown ¶ added in v0.6.0
func (factory *ResourceListFactory) FromJobResourceListFailOnUnknown(resources map[string]k8sResource.Quantity) (ResourceList, error)
Fail on unknown resources, round up.
func (*ResourceListFactory) FromJobResourceListIgnoreUnknown ¶ added in v0.6.0
func (factory *ResourceListFactory) FromJobResourceListIgnoreUnknown(resources map[string]k8sResource.Quantity) ResourceList
Ignore unknown resources, round up.
func (*ResourceListFactory) FromNodeProto ¶ added in v0.4.48
func (factory *ResourceListFactory) FromNodeProto(resources map[string]*k8sResource.Quantity) ResourceList
Ignore unknown resources, round down.
func (*ResourceListFactory) GetScale ¶ added in v0.6.0
func (factory *ResourceListFactory) GetScale(resourceTypeName string) (k8sResource.Scale, error)
func (*ResourceListFactory) MakeAllMax ¶ added in v0.15.8
func (factory *ResourceListFactory) MakeAllMax() ResourceList
func (*ResourceListFactory) MakeAllZero ¶ added in v0.6.0
func (factory *ResourceListFactory) MakeAllZero() ResourceList
func (*ResourceListFactory) MakeResourceFractionList ¶ added in v0.15.4
func (factory *ResourceListFactory) MakeResourceFractionList(m map[string]float64, defaultValue float64) ResourceFractionList
func (*ResourceListFactory) SummaryString ¶ added in v0.4.48
func (factory *ResourceListFactory) SummaryString() string
type ResourceType ¶ added in v0.14.0
type ResourceType int
const ( // A normal k8s resource, such as "memory" or "nvidia.com/gpu" Kubernetes ResourceType = iota // A floating resource that is not tied to a Kubernetes cluster or node, // e.g. "external-storage-connections". Floating = iota )
type SchedulingKey ¶ added in v0.16.6
type SchedulingKey [highwayhash.Size]byte
SchedulingKey is a hash of the scheduling requirements of a job. This key is used to efficiently mark jobs as unschedulable.
var EmptySchedulingKey SchedulingKey
type SchedulingKeyGenerator ¶ added in v0.16.6
SchedulingKeyGenerator is used to generate scheduling keys efficiently. A scheduling key is the canonical hash of the scheduling requirements of a job. All memory is allocated up-front and re-used. Thread-safe.
func NewSchedulingKeyGenerator ¶ added in v0.16.6
func NewSchedulingKeyGenerator() *SchedulingKeyGenerator
func NewSchedulingKeyGeneratorWithKey ¶ added in v0.16.6
func NewSchedulingKeyGeneratorWithKey(key []byte) *SchedulingKeyGenerator
NewSchedulingKeyGeneratorWithKey returns a new SchedulingKeyGenerator using the provided key. The key should be considered secret since scheduling key collisions can be found if it's known. Key has to be of length 32.
func (*SchedulingKeyGenerator) Key ¶ added in v0.16.6
func (skg *SchedulingKeyGenerator) Key( nodeSelector map[string]string, affinity *v1.Affinity, tolerations []v1.Toleration, requests v1.ResourceList, priorityClassName string, ) SchedulingKey