Skip to content

Fix in scorer manager in picking the best target #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 66 commits into
base: dev
Choose a base branch
from

Conversation

mayabar
Copy link
Collaborator

@mayabar mayabar commented Apr 20, 2025

No description provided.

mayabar and others added 30 commits April 10, 2025 14:50
…ill be the target for a request. Session affinity scorer added
- Rename SessionId to SessionID
- Remove datastore from scoreTargets, add datastore to SessionAffinityScorer
- Rename ScoredPod to PodScore
…f ScoreMng

- If some specific scorer failed to score pods - just log the problem, skip it and continue to the next scorer
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.37.0 to 0.38.0.
- [Commits](golang/net@v0.37.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.38.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
…odules/golang.org/x/net-0.38.0

Bump golang.org/x/net from 0.37.0 to 0.38.0
Add scorers support in scheduler
…ev-deployments

First iteration of development deployments & environments
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
…e-builds

fix: basic container image builds for linux
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Etai Lev Ran <elevran@gmail.com>
…on_yaml

empty top level kustomization.yaml - make CICD happy
shaneutt and others added 27 commits April 18, 2025 08:35
Minor fixes to enable image building matching GIE
Add inference model and pool yamls
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Etai Lev Ran <elevran@gmail.com>
upgrade golang.org/x/oauth2 to v0.27.0
Signed-off-by: Shane Utt <shaneutt@linux.com>
This is required for full GIE support

Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
Signed-off-by: Shane Utt <shaneutt@linux.com>
…l-stack

Add full stack deployment to Kind dev env
@mayabar mayabar requested a review from shmuelk April 20, 2025 11:41
@@ -92,6 +92,7 @@ func (sm *ScorerMng) scoreTargets(ctx *types.Context, pods []*types.PodMetrics)
if isFirst {
maxScore = score
highestScoreTargets = []*types.PodMetrics{pod}
isFirst = false
Copy link

@vMaroon vMaroon Apr 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isFirst can be completely dropped, because it doesn't fix the negative score case, since the array is not sorted (which would beat the point). If you want to account for negative scores, maxScore should be set to math.SmallestNonzeroFloat64.

The code block can look like:

	// select pod with maximum score, if more than one with the max score - use random pods from the list
	var highestScoreTargets []*types.PodMetrics
	// score weights could be negative
	maxScore := 0.0

	for pod, score := range podsTotalScore {
		if score > maxScore {
			maxScore = score
			highestScoreTargets = []*types.PodMetrics{pod}
		} else if score == maxScore {
			highestScoreTargets = append(highestScoreTargets, pod)
		}
	}

I think negative scores should be prohibited textually through the Scorer interface (to avoid checking it), because allowing them would let such scorers to invade and overwrite the scoring of others. For the same reasons, scores should be normalized (cc @elevran @nirrozenbaum).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @vMaroon. scorers should never return a negative value by definition.
the "normalized score" of a score should reflect in percentage the recommendation of the scorer for the pod (e.g., a float with value within the range 0-1).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend reading the NormalizeScores section in kubernetes scheduling-framework:
https://kubernetes.io/docs/concepts/scheduling-eviction/scheduling-framework/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Negative is useful (e.g., prefer the pod with the best cache coverage and lowest load can be expressed naively as kv - load when both are normalized). However it is better to use weights for that and not in the score.
The downside is that we need to decide what the value represents. Working on the assumption that we prefer Pods with higher score would mean that the LoadScorer would rate pods as "1 - load" which would give lower score to loaded Pods. This would not align with the negative weights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants