Documentation ¶
Index ¶
- Constants
- func CheckIfNodeLabelsInSpecifiedLabels(labels map[string]string, requiredLabels map[string]string) bool
- func ClearNominatedNodeName(cs clientset.Interface, pods ...*v1.Pod) utilerrors.Aggregate
- func DeletePod(cs clientset.Interface, pod *v1.Pod) error
- func EqualMap(m1, m2 map[string]string) bool
- func FormatLabels(labels map[string]string) string
- func GetDaemonSetKey(ds *appsv1.DaemonSet) string
- func GetDeployNameFromPod(pod *v1.Pod) string
- func GetMovementName(movement *schedulingv1a1.Movement) string
- func GetNamespacesFromPodAffinityTerm(pod *v1.Pod, podAffinityTerm *v1.PodAffinityTerm) sets.String
- func GetNonZeroQuantityForResource(name v1.ResourceName, requests v1.ResourceList) *resource.Quantity
- func GetNonzeroRequestForResource(resource v1.ResourceName, requests *v1.ResourceList) int64
- func GetNonzeroRequests(requests *v1.ResourceList) (int64, int64)
- func GetPDBKey(pdb *policy.PodDisruptionBudget) string
- func GetPodAffinityTerms(affinity *v1.Affinity) (terms []v1.PodAffinityTerm)
- func GetPodDebugMode(pod *v1.Pod) string
- func GetPodDebugModeOnNode(pod *v1.Pod, node *v1.Node, nmNode *nodev1alpha1.NMNode) bool
- func GetPodFullName(pod *v1.Pod) string
- func GetPodPreferedAntiAffinityTerms(affinity *v1.Affinity) (terms []v1.WeightedPodAffinityTerm)
- func GetPodRequiredAntiAffinityTerms(affinity *v1.Affinity) (terms []v1.PodAffinityTerm)
- func GetPodStartTime(pod *v1.Pod) *metav1.Time
- func GetPodWatchLabelValueString(pod *v1.Pod) string
- func GetReplicaSetKey(rs *appsv1.ReplicaSet) string
- func GetScheduler(cs crdclientset.Interface, schedulerName string) (*v1alpha1.Scheduler, error)
- func MarshalMicroTopology(topology map[int]*v1.ResourceList) string
- func MergeLabels(labels1, labels2 map[string]string) map[string]string
- func NeedConsiderTopology(pod *v1.Pod) (bool, bool)
- func NeedNumaBinding(pod *v1.Pod) (bool, bool)
- func NodesHaveSameTopologyKey(nodeA, nodeB *v1.Node, topologyKey string) bool
- func ParallelizeUntil(stop *bool, workers int, pieces int, doWorkPiece func(piece int))
- func PatchPod(cs clientset.Interface, old *v1.Pod, new *v1.Pod) (err error)
- func PodMatchesTermsNamespaceAndSelector(pod *v1.Pod, namespaces sets.String, selector labels.Selector) bool
- func PostScheduler(cs crdclientset.Interface, scheduler *v1alpha1.Scheduler) (*v1alpha1.Scheduler, error)
- func RemoveLabels(labels1, labels2 map[string]string) map[string]string
- func Retry(attempts int, sleep time.Duration, f func() error) error
- func SetMetaDataLabel(obj *metav1.ObjectMeta, key string, value string)
- func SetMetaDataMap(obj *metav1.ObjectMeta, key string, value string)
- func UnmarshalMicroTopology(microTopologyStr string) (map[int]*v1.ResourceList, error)
- func UpdateSchedulerStatus(cs crdclientset.Interface, scheduler *v1alpha1.Scheduler) (*v1alpha1.Scheduler, error)
- type Clock
- type QoSLevel
- type RealClock
- type Topologies
Constants ¶
const ( // Unknown event Unknown = "Unknown" // PodAdd is the event when a new pod is added to API server. PodAdd = "PodAdd" // NodeAdd is the event when a new node is added to the cluster. NodeAdd = "NodeAdd" // NMNodeAdd is the event when a new NMNode is added to the cluster. NMNodeAdd = "NMNodeAdd" // CNRAdd is the event when a new CNR is added to the cluster. CNRAdd = "CNRAdd" // NodePartitionScaleOut is the event when scheduler's node partition changes from Physical to Logical. NodePartitionScaleOut = "NodePartitionScaleOut" // ScheduleAttemptFailure is the event when a schedule attempt fails. ScheduleAttemptFailure = "ScheduleAttemptFailure" // CreateUnitSucceed CreateUnitSucceed = "CreateUnitSucceed" // WaitingComplete is the event when a pod finishes waiting. WaitingComplete = "WaitingComplete" // BackoffComplete is the event when a pod finishes backoff. BackoffComplete = "BackoffComplete" // UnitReady is the event when an unit's ready to be scheduled. UnitReady = "UnitReady" // UnschedulableTimeout is the event when a pod stays in unschedulable for longer than timeout. UnschedulableTimeout = "UnschedulableTimeout" // AssignedPodAdd is the event when a pod is added that causes pods with matching affinity terms // to be more schedulable. AssignedPodAdd = "AssignedPodAdd" // AssignedPodUpdate is the event when a pod is updated that causes pods with matching affinity // terms to be more schedulable. AssignedPodUpdate = "AssignedPodUpdate" // AssignedPodDelete is the event when a pod is deleted that causes pods with matching affinity // terms to be more schedulable. AssignedPodDelete = "AssignedPodDelete" // PvAdd is the event when a persistent volume is added in the cluster. PvAdd = "PvAdd" // PvUpdate is the event when a persistent volume is updated in the cluster. PvUpdate = "PvUpdate" // PvcAdd is the event when a persistent volume claim is added in the cluster. PvcAdd = "PvcAdd" // PvcUpdate is the event when a persistent volume claim is updated in the cluster. PvcUpdate = "PvcUpdate" // StorageClassAdd is the event when a StorageClass is added in the cluster. StorageClassAdd = "StorageClassAdd" // ServiceAdd is the event when a service is added in the cluster. ServiceAdd = "ServiceAdd" // ServiceUpdate is the event when a service is updated in the cluster. ServiceUpdate = "ServiceUpdate" // ServiceDelete is the event when a service is deleted in the cluster. ServiceDelete = "ServiceDelete" // CSINodeAdd is the event when a CSI node is added in the cluster. CSINodeAdd = "CSINodeAdd" // CSINodeUpdate is the event when a CSI node is updated in the cluster. CSINodeUpdate = "CSINodeUpdate" // NodeSpecUnschedulableChange is the event when unschedulable node spec is changed. NodeSpecUnschedulableChange = "NodeSpecUnschedulableChange" // NodeAllocatableChange is the event when node allocatable is changed. NodeAllocatableChange = "NodeAllocatableChange" // NodeLabelsChange is the event when node label is changed. NodeLabelChange = "NodeLabelChange" // NodeTaintsChange is the event when node taint is changed. NodeTaintChange = "NodeTaintChange" // NodeConditionChange is the event when node condition is changed. NodeConditionChange = "NodeConditionChange" // PodGroupAdd is the event when a pod group is added in the cluster. PodGroupAdd = "PodGroupAdd" // PodGroupUpdate is the event when a pod group is updated in the cluster. PodGroupUpdate = "PodGroupUpdate" // ReservationDelete is the event when a reservation is deleted in the cluster. ReservationDelete = "ReservationDelete" )
Events that trigger scheduler queue to change.
const ( // DefaultMilliCPURequest defines default milli cpu request number. DefaultMilliCPURequest int64 = 100 // 0.1 core // DefaultMemoryRequest defines default memory request size. DefaultMemoryRequest int64 = 200 * 1024 * 1024 // 200 MB )
For each of these resources, a pod that doesn't request the resource explicitly will be treated as having requested the amount indicated below, for the purpose of computing priority only. This ensures that when scheduling zero-request pods, such pods will not all be scheduled to the machine with the smallest in-use request, and that when scheduling regular pods, such pods will not see zero-request pods as consuming no resources whatsoever. We chose these values to be similar to the resources that we give to cluster addon pods (#10653). But they are pretty arbitrary. As described in #11713, we use request instead of limit to deal with resource requirements.
const ( ResourceSriov v1.ResourceName = "bytedance.com/sriov.nic" ResourceGPU v1.ResourceName = "nvidia.com/gpu" ResourceNuma v1.ResourceName = "numa" )
const ( CanBePreemptedAnnotationKey = "godel.bytedance.com/can-be-preempted" CanBePreempted = "true" CannotBePreempted = "false" PreemptionPolicyKey = "godel.bytedance.com/preemption-policy" ObjectNameField = "metadata.name" // Debug Level DebugModeAnnotationKey = "godel.bytedance.com/debug-mode" // Debug Mode ON DebugModeOn = "on" // Debug Mode OFF DebugModeOff = "off" // Node that the pod want to watch by node labels WatchNodeNameLabelName = "godel.bytedance.com/watch-node-label" SemicolonSeperator = ";" CommaSeperator = "," ColonSeperator = ":" EqualSignSeperator = "=" QoSLevelKey = "katalyst.kubewharf.io/qos_level" MemoyEnhancementKey = "katalyst.kubewharf.io/memory_enhancement" // NumaBindingKey is a key that illustrate whether the pod needs bind numa NumaBindingKey = "numa_binding" NumaExclusiveKey = "numa_exclusive" OwnerTypeDaemonSet = "DaemonSet" OwnerTypeReplicaSet = "ReplicaSet" MaxAPICallRetryTimes = 3 // TODO: 5 will cause a timeout in UT (30s) )
const (
DeployNameKeyInPodLabels = "name"
)
const MemoyEnhancementTrue string = "true"
Variables ¶
This section is empty.
Functions ¶
func ClearNominatedNodeName ¶
ClearNominatedNodeName internally submit a patch request to API server to set each pods[*].Status.NominatedNodeName> to "".
func FormatLabels ¶
func GetDaemonSetKey ¶
func GetDeployNameFromPod ¶
TODO: if we support multiple controller kinds later, we need to get the controller name
func GetMovementName ¶
func GetMovementName(movement *schedulingv1a1.Movement) string
func GetNamespacesFromPodAffinityTerm ¶
GetNamespacesFromPodAffinityTerm returns a set of names according to the namespaces indicated in podAffinityTerm. If namespaces is empty it considers the given pod's namespace.
func GetNonZeroQuantityForResource ¶
func GetNonZeroQuantityForResource(name v1.ResourceName, requests v1.ResourceList) *resource.Quantity
func GetNonzeroRequestForResource ¶
func GetNonzeroRequestForResource(resource v1.ResourceName, requests *v1.ResourceList) int64
GetNonzeroRequestForResource returns the default resource request if none is found or what is provided on the request.
func GetNonzeroRequests ¶
func GetNonzeroRequests(requests *v1.ResourceList) (int64, int64)
GetNonzeroRequests returns the default cpu and memory resource request if none is found or what is provided on the request.
func GetPDBKey ¶
func GetPDBKey(pdb *policy.PodDisruptionBudget) string
func GetPodAffinityTerms ¶
func GetPodAffinityTerms(affinity *v1.Affinity) (terms []v1.PodAffinityTerm)
GetPodAffinityTerms gets pod affinity terms by a pod affinity object.
func GetPodDebugModeOnNode ¶
func GetPodFullName ¶
GetPodFullName returns a name that uniquely identifies a pod.
func GetPodPreferedAntiAffinityTerms ¶
func GetPodPreferedAntiAffinityTerms(affinity *v1.Affinity) (terms []v1.WeightedPodAffinityTerm)
GetPodPreferedAntiAffinityTerms gets pod affinity terms by a pod prefered-anti-affinity.
func GetPodRequiredAntiAffinityTerms ¶
func GetPodRequiredAntiAffinityTerms(affinity *v1.Affinity) (terms []v1.PodAffinityTerm)
GetPodRequiredAntiAffinityTerms gets pod affinity terms by a pod require-anti-affinity.
func GetPodStartTime ¶
GetPodStartTime returns start time of the given pod or current timestamp if it hasn't started yet.
func GetPodWatchLabelValueString ¶
Get Pod watch label value string
func GetReplicaSetKey ¶
func GetReplicaSetKey(rs *appsv1.ReplicaSet) string
func GetScheduler ¶
GetScheduler returns the latest <scheduler> from API server
func MarshalMicroTopology ¶
func MarshalMicroTopology(topology map[int]*v1.ResourceList) string
func NeedConsiderTopology ¶
NeedConsiderTopology checks if need to consider numa topology
func NeedNumaBinding ¶
NeedNumaBinding checks if need to consider numa topology
func NodesHaveSameTopologyKey ¶
NodesHaveSameTopologyKey checks if nodeA and nodeB have same label value with given topologyKey as label key. Returns false if topologyKey is empty.
func ParallelizeUntil ¶
func PatchPod ¶
PatchPod calculates the delta bytes change from <old> to <new>, and then submit a request to API server to patch the pod changes.
func PodMatchesTermsNamespaceAndSelector ¶
func PodMatchesTermsNamespaceAndSelector(pod *v1.Pod, namespaces sets.String, selector labels.Selector) bool
PodMatchesTermsNamespaceAndSelector returns true if the given <pod> matches the namespace and selector defined by <affinityPod>`s <term>.
func PostScheduler ¶
func PostScheduler(cs crdclientset.Interface, scheduler *v1alpha1.Scheduler) (*v1alpha1.Scheduler, error)
PostScheduler create v1alpha1.Scheduler in API server
func SetMetaDataLabel ¶
func SetMetaDataLabel(obj *metav1.ObjectMeta, key string, value string)
func SetMetaDataMap ¶
func SetMetaDataMap(obj *metav1.ObjectMeta, key string, value string)
func UnmarshalMicroTopology ¶
func UnmarshalMicroTopology(microTopologyStr string) (map[int]*v1.ResourceList, error)
func UpdateSchedulerStatus ¶
func UpdateSchedulerStatus(cs crdclientset.Interface, scheduler *v1alpha1.Scheduler) (*v1alpha1.Scheduler, error)
UpdateSchedulerStatus updates v1alpha1.Scheduler in API server
Types ¶
type Topologies ¶
type Topologies struct {
DefaultKeys []string
}
Topologies contains topologies information of nodes.
func (*Topologies) NodesHaveSameTopologyKey ¶
func (tps *Topologies) NodesHaveSameTopologyKey(nodeA, nodeB *v1.Node, topologyKey string) bool
NodesHaveSameTopologyKey checks if nodeA and nodeB have same label value with given topologyKey as label key.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
package taints implements utilities for working with taints
|
package taints implements utilities for working with taints |
volume
|
|