Skip to content

Commit

Permalink
Merge pull request #1330 from sunpa93/scheduler-volume-access-mode-check
Browse files Browse the repository at this point in the history
[V2] bug: azdiskscheduler volume access mode check for prioritize instead of filter
  • Loading branch information
edreed authored May 20, 2022
2 parents 48ee115 + 374269b commit 6b678e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/azdiskschedulerextender/azdiskschedulerextender.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func filter(context context.Context, schedulerExtenderArgs schedulerapi.Extender
}
}

diskRequestedByPod, diskRequestedByPodCount := getDisksRequestedByPod(ns, requestedVolumes, v1.ReadOnlyMany, v1.ReadWriteMany)
diskRequestedByPod, diskRequestedByPodCount := getDisksRequestedByPodExcludeAccessModes(ns, requestedVolumes)
if diskRequestedByPodCount == 0 {
return formatFilterResult(schedulerExtenderArgs.Nodes.Items, schedulerExtenderArgs.NodeNames, failedNodes, ""), nil
}
Expand Down Expand Up @@ -244,7 +244,7 @@ func prioritize(context context.Context, schedulerExtenderArgs schedulerapi.Exte
go getAzVolumeAttachments(context, volumesChan)

// create a lookup map of all the volumes the pod needs
volumesPodNeeds, _ := getDisksRequestedByPod(ns, requestedVolumes)
volumesPodNeeds, _ := getDisksRequestedByPodExcludeAccessModes(ns, requestedVolumes, v1.ReadOnlyMany, v1.ReadWriteMany)

// get all nodes that have azDriverNode running
azDriverNodesMeta := <-nodesChan
Expand Down Expand Up @@ -431,7 +431,7 @@ func setNodeScoresToZero(nodes []v1.Node) (priorityList schedulerapi.HostPriorit
return
}

func getDisksRequestedByPod(ns string, requestedVolumes []v1.Volume, filterOutAccessModes ...v1.PersistentVolumeAccessMode) (disksRequestedByPod map[string]struct{}, requestedDiskCount int) {
func getDisksRequestedByPodExcludeAccessModes(ns string, requestedVolumes []v1.Volume, filterOutAccessModes ...v1.PersistentVolumeAccessMode) (disksRequestedByPod map[string]struct{}, requestedDiskCount int) {
// create a set of all volumes needed
disksRequestedByPod = map[string]struct{}{}
for _, volume := range requestedVolumes {
Expand Down

0 comments on commit 6b678e6

Please sign in to comment.