var _ … var _ … var _ … var _ … var _ … const Name … const preFilterStateKey … const preScoreStateKey … var nodeResourceStrategyTypeMap … type Fit … // ScoreExtensions of the Score plugin. func (f *Fit) ScoreExtensions() framework.ScoreExtensions { … } type preFilterState … // Clone the prefilter state. func (s *preFilterState) Clone() framework.StateData { … } type preScoreState … // Clone implements the mandatory Clone interface. We don't really copy the data since // there is no need for that. func (s *preScoreState) Clone() framework.StateData { … } // PreScore calculates incoming pod's resource requests and writes them to the cycle state used. func (f *Fit) PreScore(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodes []*framework.NodeInfo) *framework.Status { … } func getPreScoreState(cycleState *framework.CycleState) (*preScoreState, error) { … } // Name returns name of the plugin. It is used in logs, etc. func (f *Fit) Name() string { … } // NewFit initializes a new plugin and returns it. func NewFit(_ context.Context, plArgs runtime.Object, h framework.Handle, fts feature.Features) (framework.Plugin, error) { … } // computePodResourceRequest returns a framework.Resource that covers the largest // width in each resource dimension. Because init-containers run sequentially, we collect // the max in each dimension iteratively. In contrast, we sum the resource vectors for // regular containers since they run simultaneously. // // # The resources defined for Overhead should be added to the calculated Resource request sum // // Example: // // Pod: // // InitContainers // IC1: // CPU: 2 // Memory: 1G // IC2: // CPU: 2 // Memory: 3G // Containers // C1: // CPU: 2 // Memory: 1G // C2: // CPU: 1 // Memory: 1G // // Result: CPU: 3, Memory: 3G func computePodResourceRequest(pod *v1.Pod) *preFilterState { … } // PreFilter invoked at the prefilter extension point. func (f *Fit) PreFilter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod) (*framework.PreFilterResult, *framework.Status) { … } // PreFilterExtensions returns prefilter extensions, pod add and remove. func (f *Fit) PreFilterExtensions() framework.PreFilterExtensions { … } func getPreFilterState(cycleState *framework.CycleState) (*preFilterState, error) { … } // EventsToRegister returns the possible events that may make a Pod // failed by this plugin schedulable. func (f *Fit) EventsToRegister(_ context.Context) ([]framework.ClusterEventWithHint, error) { … } // isSchedulableAfterPodEvent is invoked whenever a pod deleted or scaled down. It checks whether // that change made a previously unschedulable pod schedulable. func (f *Fit) isSchedulableAfterPodEvent(logger klog.Logger, pod *v1.Pod, oldObj, newObj interface{ … } // isSchedulableAfterPodScaleDown checks whether the scale down event may make the target pod schedulable. Specifically: // - Returns true when the update event is for the target pod itself. // - Returns true when the update event shows a scheduled pod's resource request that the target pod also requests got reduced. func (f *Fit) isSchedulableAfterPodScaleDown(targetPod, originalPod, modifiedPod *v1.Pod) bool { … } // isSchedulableAfterNodeChange is invoked whenever a node added or changed. It checks whether // that change could make a previously unschedulable pod schedulable. func (f *Fit) isSchedulableAfterNodeChange(logger klog.Logger, pod *v1.Pod, oldObj, newObj interface{ … } // haveAnyRequestedResourcesIncreased returns true if any of the resources requested by the pod have increased or if allowed pod number increased. func haveAnyRequestedResourcesIncreased(pod *v1.Pod, originalNode, modifiedNode *v1.Node) bool { … } // isFit checks if the pod fits the node. If the node is nil, it returns false. // It constructs a fake NodeInfo object for the node and checks if the pod fits the node. func isFit(pod *v1.Pod, node *v1.Node) bool { … } // Filter invoked at the filter extension point. // Checks if a node has sufficient resources, such as cpu, memory, gpu, opaque int resources etc to run a pod. // It returns a list of insufficient resources, if empty, then the node has all the resources requested by the pod. func (f *Fit) Filter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status { … } func hasRestartableInitContainer(pod *v1.Pod) bool { … } type InsufficientResource … // Fits checks if node have enough resources to host the pod. func Fits(pod *v1.Pod, nodeInfo *framework.NodeInfo) []InsufficientResource { … } func fitsRequest(podRequest *preFilterState, nodeInfo *framework.NodeInfo, ignoredExtendedResources, ignoredResourceGroups sets.Set[string]) []InsufficientResource { … } // Score invoked at the Score extension point. func (f *Fit) Score(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status) { … }