manually revert #109877
This commit is contained in:
@@ -48,7 +48,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/volumebinding/metrics"
|
||||
"k8s.io/kubernetes/pkg/scheduler/util/assumecache"
|
||||
"k8s.io/kubernetes/pkg/volume/util"
|
||||
)
|
||||
|
||||
// ConflictReason is used for the special strings which explain why
|
||||
@@ -130,8 +129,6 @@ type InTreeToCSITranslator interface {
|
||||
// 1. The scheduler takes a Pod off the scheduler queue and processes it serially:
|
||||
// a. Invokes all pre-filter plugins for the pod. GetPodVolumeClaims() is invoked
|
||||
// here, pod volume information will be saved in current scheduling cycle state for later use.
|
||||
// If pod has bound immediate PVCs, GetEligibleNodes() is invoked to potentially reduce
|
||||
// down the list of eligible nodes based on the bound PV's NodeAffinity (if any).
|
||||
// b. Invokes all filter plugins, parallelized across nodes. FindPodVolumes() is invoked here.
|
||||
// c. Invokes all score plugins. Future/TBD
|
||||
// d. Selects the best node for the Pod.
|
||||
@@ -154,14 +151,6 @@ type SchedulerVolumeBinder interface {
|
||||
// unbound with immediate binding (including prebound) and PVs that belong to storage classes of unbound PVCs with delayed binding.
|
||||
GetPodVolumeClaims(logger klog.Logger, pod *v1.Pod) (podVolumeClaims *PodVolumeClaims, err error)
|
||||
|
||||
// GetEligibleNodes checks the existing bound claims of the pod to determine if the list of nodes can be
|
||||
// potentially reduced down to a subset of eligible nodes based on the bound claims which then can be used
|
||||
// in subsequent scheduling stages.
|
||||
//
|
||||
// If eligibleNodes is 'nil', then it indicates that such eligible node reduction cannot be made
|
||||
// and all nodes should be considered.
|
||||
GetEligibleNodes(logger klog.Logger, boundClaims []*v1.PersistentVolumeClaim) (eligibleNodes sets.Set[string])
|
||||
|
||||
// FindPodVolumes checks if all of a Pod's PVCs can be satisfied by the
|
||||
// node and returns pod's volumes information.
|
||||
//
|
||||
@@ -384,55 +373,6 @@ func (b *volumeBinder) FindPodVolumes(logger klog.Logger, pod *v1.Pod, podVolume
|
||||
return
|
||||
}
|
||||
|
||||
// GetEligibleNodes checks the existing bound claims of the pod to determine if the list of nodes can be
|
||||
// potentially reduced down to a subset of eligible nodes based on the bound claims which then can be used
|
||||
// in subsequent scheduling stages.
|
||||
//
|
||||
// Returning 'nil' for eligibleNodes indicates that such eligible node reduction cannot be made and all nodes
|
||||
// should be considered.
|
||||
func (b *volumeBinder) GetEligibleNodes(logger klog.Logger, boundClaims []*v1.PersistentVolumeClaim) (eligibleNodes sets.Set[string]) {
|
||||
if len(boundClaims) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
var errs []error
|
||||
for _, pvc := range boundClaims {
|
||||
pvName := pvc.Spec.VolumeName
|
||||
pv, err := b.pvCache.GetPV(pvName)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
continue
|
||||
}
|
||||
|
||||
// if the PersistentVolume is local and has node affinity matching specific node(s),
|
||||
// add them to the eligible nodes
|
||||
nodeNames := util.GetLocalPersistentVolumeNodeNames(pv)
|
||||
if len(nodeNames) != 0 {
|
||||
// on the first found list of eligible nodes for the local PersistentVolume,
|
||||
// insert to the eligible node set.
|
||||
if eligibleNodes == nil {
|
||||
eligibleNodes = sets.New(nodeNames...)
|
||||
} else {
|
||||
// for subsequent finding of eligible nodes for the local PersistentVolume,
|
||||
// take the intersection of the nodes with the existing eligible nodes
|
||||
// for cases if PV1 has node affinity to node1 and PV2 has node affinity to node2,
|
||||
// then the eligible node list should be empty.
|
||||
eligibleNodes = eligibleNodes.Intersection(sets.New(nodeNames...))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(errs) > 0 {
|
||||
logger.V(4).Info("GetEligibleNodes: one or more error occurred finding eligible nodes", "error", errs)
|
||||
return nil
|
||||
}
|
||||
|
||||
if eligibleNodes != nil {
|
||||
logger.V(4).Info("GetEligibleNodes: reduced down eligible nodes", "nodes", eligibleNodes)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// AssumePodVolumes will take the matching PVs and PVCs to provision in pod's
|
||||
// volume information for the chosen node, and:
|
||||
// 1. Update the pvCache with the new prebound PV.
|
||||
|
||||
Reference in New Issue
Block a user