Documentation ¶
Index ¶
- Constants
- func GetVPod(key types.NamespacedName, vpods []scheduler.VPod) scheduler.VPod
- func OrdinalFromPodName(podName string) int32
- func PodNameFromOrdinal(name string, ordinal int32) string
- func SatisfyNodeAvailability(feasiblePods []int32, states *State) bool
- func SatisfyZoneAvailability(feasiblePods []int32, states *State) bool
- type AvailabilityNodePriorityArgs
- type AvailabilityZonePriorityArgs
- type Code
- type EvenPodSpreadArgs
- type FilterPlugin
- type NoMaxResourceCountArgs
- type Plugin
- type PluginToPodScores
- type PluginToStatus
- type PodScore
- type PodScoreList
- type ScoreExtensions
- type ScorePlugin
- type State
- type StateAccessor
- type Status
Constants ¶
const ( PodFitsResources = "PodFitsResources" NoMaxResourceCount = "NoMaxResourceCount" EvenPodSpread = "EvenPodSpread" AvailabilityNodePriority = "AvailabilityNodePriority" AvailabilityZonePriority = "AvailabilityZonePriority" LowestOrdinalPriority = "LowestOrdinalPriority" RemoveWithEvenPodSpreadPriority = "RemoveWithEvenPodSpreadPriority" RemoveWithAvailabilityNodePriority = "RemoveWithAvailabilityNodePriority" RemoveWithAvailabilityZonePriority = "RemoveWithAvailabilityZonePriority" RemoveWithHighestOrdinalPriority = "RemoveWithHighestOrdinalPriority" )
Variables ¶
This section is empty.
Functions ¶
func OrdinalFromPodName ¶
func PodNameFromOrdinal ¶
func SatisfyNodeAvailability ¶
func SatisfyZoneAvailability ¶
Types ¶
type AvailabilityNodePriorityArgs ¶
type AvailabilityNodePriorityArgs struct {
MaxSkew int32
}
AvailabilityNodePriorityArgs holds arguments used to configure the AvailabilityNodePriority plugin.
type AvailabilityZonePriorityArgs ¶
type AvailabilityZonePriorityArgs struct {
MaxSkew int32
}
AvailabilityZonePriorityArgs holds arguments used to configure the AvailabilityZonePriority plugin.
type Code ¶
type Code int
Code is the Status code/type which is returned from plugins.
const ( // Success means that plugin ran correctly and found pod schedulable. Success Code = iota // Unschedulable is used when a plugin finds a pod unschedulable due to not satisying the predicate. Unschedulable // Error is used for internal plugin errors, unexpected input, etc. Error )
These are predefined codes used in a Status.
type EvenPodSpreadArgs ¶
type EvenPodSpreadArgs struct {
MaxSkew int32
}
EvenPodSpreadArgs holds arguments used to configure the EvenPodSpread plugin.
type FilterPlugin ¶
type NoMaxResourceCountArgs ¶
type NoMaxResourceCountArgs struct {
NumPartitions int
}
NoMaxResourceCountArgs holds arguments used to configure the NoMaxResourceCount plugin.
type Plugin ¶
type Plugin interface {
Name() string
}
Plugin is the parent type for all the scheduling framework plugins.
type PluginToPodScores ¶
type PluginToPodScores map[string]PodScoreList
PluginToPodScores declares a map from plugin name to its PodScoreList.
type PluginToStatus ¶
PluginToStatus maps plugin name to status. Currently used to identify which Filter plugin returned which status.
func (PluginToStatus) Merge ¶
func (p PluginToStatus) Merge() *Status
Merge merges the statuses in the map into one. The resulting status code have the following precedence: Error, Unschedulable, Success
type PodScoreList ¶
type PodScoreList []PodScore
type ScoreExtensions ¶
type ScoreExtensions interface { // NormalizeScore is called for all pod scores produced by the same plugin's "Score" // method. A successful run of NormalizeScore will update the scores list and return // a success status. NormalizeScore(ctx context.Context, state *State, scores PodScoreList) *Status }
ScoreExtensions is an interface for Score extended functionality.
type ScorePlugin ¶
type ScorePlugin interface { Plugin // Score is called by the scheduler. // All ScorePlugins should return "Success" unless the args are invalid. Score(ctx context.Context, args interface{}, state *State, feasiblePods []int32, key types.NamespacedName, podID int32) (uint64, *Status) // ScoreExtensions returns a ScoreExtensions interface if it implements one, or nil if does not ScoreExtensions() ScoreExtensions }
type State ¶
type State struct { // free tracks the free capacity of each pod. FreeCap []int32 // schedulable pods tracks the pods that aren't being evicted. SchedulablePods []int32 // LastOrdinal is the ordinal index corresponding to the last statefulset replica // with placed vpods. LastOrdinal int32 // Pod capacity. Capacity int32 // Replicas is the (cached) number of statefulset replicas. Replicas int32 // Number of available zones in cluster NumZones int32 // Number of available nodes in cluster NumNodes int32 // Scheduling policy type for placing vreplicas on pods SchedulerPolicy scheduler.SchedulerPolicyType // Scheduling policy plugin for placing vreplicas on pods SchedPolicy *scheduler.SchedulerPolicy // De-scheduling policy plugin for removing vreplicas from pods DeschedPolicy *scheduler.SchedulerPolicy // Mapping node names of nodes currently in cluster to their zone info NodeToZoneMap map[string]string StatefulSetName string PodLister corev1.PodNamespaceLister // Stores for each vpod, a map of podname to number of vreplicas placed on that pod currently PodSpread map[types.NamespacedName]map[string]int32 // Stores for each vpod, a map of nodename to total number of vreplicas placed on all pods running on that node currently NodeSpread map[types.NamespacedName]map[string]int32 // Stores for each vpod, a map of zonename to total number of vreplicas placed on all pods located in that zone currently ZoneSpread map[types.NamespacedName]map[string]int32 }
state provides information about the current scheduling of all vpods It is used by for the scheduler and the autoscaler
func (*State) FreeCapacity ¶
freeCapacity returns the number of vreplicas that can be used, up to the last ordinal
func (*State) GetPodInfo ¶
type StateAccessor ¶
type StateAccessor interface { // State returns the current state (snapshot) about placed vpods // Take into account reserved vreplicas and update `reserved` to reflect // the current state. State(reserved map[types.NamespacedName]map[string]int32) (*State, error) }
func NewStateBuilder ¶
func NewStateBuilder(ctx context.Context, namespace, sfsname string, lister scheduler.VPodLister, podCapacity int32, schedulerPolicy scheduler.SchedulerPolicyType, schedPolicy *scheduler.SchedulerPolicy, deschedPolicy *scheduler.SchedulerPolicy, podlister corev1.PodNamespaceLister, nodeLister corev1.NodeLister) StateAccessor
NewStateBuilder returns a StateAccessor recreating the state from scratch each time it is requested
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
Status indicates the result of running a plugin.
func (*Status) AsError ¶
AsError returns nil if the status is a success; otherwise returns an "error" object with a concatenated message on reasons of the Status.
func (*Status) IsSuccess ¶
IsSuccess returns true if and only if "Status" is nil or Code is "Success".
func (*Status) IsUnschedulable ¶
IsUnschedulable returns true if "Status" is Unschedulable