Skip to content

Commit 493cda7

Browse files
nirrozenbaumshmuelk
authored andcommitted
adds New functions to the scorers for consistency (kubernetes-sigs#975)
* adds New functions to the scorers for consistency Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com> * update main to use the scorer new functions Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com> --------- Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>
1 parent d2d7f38 commit 493cda7

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

cmd/epp/runner/runner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ func (r *Runner) initializeScheduler(datastore datastore.Datastore) (*scheduling
272272
kvCacheScorerWeight := envutil.GetEnvInt("KV_CACHE_SCORE_WEIGHT", scorer.DefaultKVCacheScorerWeight, setupLog)
273273

274274
schedulerProfile := framework.NewSchedulerProfile().
275-
WithScorers(framework.NewWeightedScorer(&scorer.QueueScorer{}, queueScorerWeight),
276-
framework.NewWeightedScorer(&scorer.KVCacheScorer{}, kvCacheScorerWeight)).
275+
WithScorers(framework.NewWeightedScorer(scorer.NewQueueScorer(), queueScorerWeight),
276+
framework.NewWeightedScorer(scorer.NewKVCacheScorer(), kvCacheScorerWeight)).
277277
WithPicker(picker.NewMaxScorePicker())
278278

279279
if prefixCacheScheduling {

pkg/epp/scheduling/framework/plugins/scorer/kvcache.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ const (
3333
// compile-time type assertion
3434
var _ framework.Scorer = &KVCacheScorer{}
3535

36+
// NewKVCacheScorer initializes a new KVCacheScorer and returns its pointer.
37+
func NewKVCacheScorer() *KVCacheScorer {
38+
return &KVCacheScorer{}
39+
}
40+
3641
// KvCacheScorerFactory is the factory for the KV-Cache scorer
3742
func KvCacheScorerFactory(_ json.RawMessage) (plugins.Plugin, error) {
3843
return &KVCacheScorer{}, nil

pkg/epp/scheduling/framework/plugins/scorer/queue.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ const (
3434
// compile-time type assertion
3535
var _ framework.Scorer = &QueueScorer{}
3636

37+
// NewQueueScorer initializes a new QueueScorer and returns its pointer.
38+
func NewQueueScorer() *QueueScorer {
39+
return &QueueScorer{}
40+
}
41+
3742
// QueueScorerFactory is the factory for the Queue based scorer
3843
func QueueScorerFactory(_ json.RawMessage) (plugins.Plugin, error) {
3944
return &QueueScorer{}, nil

0 commit comments

Comments
 (0)