Use the generic Set in scheduler

This commit is contained in:
sarab
2023-03-27 13:16:13 +05:30
parent 8f15859afc
commit 8d18ae6fc2
50 changed files with 348 additions and 346 deletions

View File

@@ -174,7 +174,7 @@ type PriorityQueue struct {
// when we received move request.
moveRequestCycle int64
clusterEventMap map[framework.ClusterEvent]sets.String
clusterEventMap map[framework.ClusterEvent]sets.Set[string]
// preEnqueuePluginMap is keyed with profile name, valued with registered preEnqueue plugins.
preEnqueuePluginMap map[string][]framework.PreEnqueuePlugin
@@ -197,7 +197,7 @@ type priorityQueueOptions struct {
podLister listersv1.PodLister
metricsRecorder metrics.MetricAsyncRecorder
pluginMetricsSamplePercent int
clusterEventMap map[framework.ClusterEvent]sets.String
clusterEventMap map[framework.ClusterEvent]sets.Set[string]
preEnqueuePluginMap map[string][]framework.PreEnqueuePlugin
}
@@ -233,7 +233,7 @@ func WithPodLister(pl listersv1.PodLister) Option {
}
// WithClusterEventMap sets clusterEventMap for PriorityQueue.
func WithClusterEventMap(m map[framework.ClusterEvent]sets.String) Option {
func WithClusterEventMap(m map[framework.ClusterEvent]sets.Set[string]) Option {
return func(o *priorityQueueOptions) {
o.clusterEventMap = m
}
@@ -283,7 +283,7 @@ func newQueuedPodInfoForLookup(pod *v1.Pod, plugins ...string) *framework.Queued
// and so we avoid creating a full PodInfo, which is expensive to instantiate frequently.
return &framework.QueuedPodInfo{
PodInfo: &framework.PodInfo{Pod: pod},
UnschedulablePlugins: sets.NewString(plugins...),
UnschedulablePlugins: sets.New(plugins...),
}
}
@@ -903,7 +903,7 @@ func (p *PriorityQueue) newQueuedPodInfo(pod *v1.Pod, plugins ...string) *framew
PodInfo: podInfo,
Timestamp: now,
InitialAttemptTimestamp: now,
UnschedulablePlugins: sets.NewString(plugins...),
UnschedulablePlugins: sets.New(plugins...),
}
}
@@ -1170,7 +1170,7 @@ func (p *PriorityQueue) podMatchesEvent(podInfo *framework.QueuedPodInfo, cluste
return false
}
func intersect(x, y sets.String) bool {
func intersect(x, y sets.Set[string]) bool {
if len(x) > len(y) {
x, y = y, x
}