Merge pull request #83849 from draveness/feature/node-locality-as-score-plugin
feat: implement imagelocality as a score plugin
This commit is contained in:
@@ -171,7 +171,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
wantPrioritizers: sets.NewString(
|
||||
"EqualPriority",
|
||||
"NodeAffinityPriority",
|
||||
"ImageLocalityPriority",
|
||||
"LeastRequestedPriority",
|
||||
"BalancedResourceAllocation",
|
||||
"SelectorSpreadPriority",
|
||||
@@ -185,6 +184,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
{Name: "NodeResources"},
|
||||
{Name: "VolumeRestrictions"},
|
||||
},
|
||||
"ScorePlugin": {
|
||||
{Name: "ImageLocality", Weight: 2},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -235,7 +237,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
),
|
||||
wantPrioritizers: sets.NewString(
|
||||
"EqualPriority",
|
||||
"ImageLocalityPriority",
|
||||
"LeastRequestedPriority",
|
||||
"BalancedResourceAllocation",
|
||||
"SelectorSpreadPriority",
|
||||
@@ -250,7 +251,10 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
{Name: "VolumeRestrictions"},
|
||||
{Name: "TaintToleration"},
|
||||
},
|
||||
"ScorePlugin": {{Name: "TaintToleration", Weight: 2}},
|
||||
"ScorePlugin": {
|
||||
{Name: "ImageLocality", Weight: 2},
|
||||
{Name: "TaintToleration", Weight: 2},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -305,7 +309,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
),
|
||||
wantPrioritizers: sets.NewString(
|
||||
"EqualPriority",
|
||||
"ImageLocalityPriority",
|
||||
"LeastRequestedPriority",
|
||||
"BalancedResourceAllocation",
|
||||
"SelectorSpreadPriority",
|
||||
@@ -322,7 +325,10 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
{Name: "VolumeRestrictions"},
|
||||
{Name: "TaintToleration"},
|
||||
},
|
||||
"ScorePlugin": {{Name: "TaintToleration", Weight: 2}},
|
||||
"ScorePlugin": {
|
||||
{Name: "ImageLocality", Weight: 2},
|
||||
{Name: "TaintToleration", Weight: 2},
|
||||
},
|
||||
},
|
||||
},
|
||||
// Do not change this JSON after the corresponding release has been tagged.
|
||||
@@ -386,7 +392,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
),
|
||||
wantPrioritizers: sets.NewString(
|
||||
"EqualPriority",
|
||||
"ImageLocalityPriority",
|
||||
"LeastRequestedPriority",
|
||||
"BalancedResourceAllocation",
|
||||
"SelectorSpreadPriority",
|
||||
@@ -403,7 +408,10 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
{Name: "VolumeRestrictions"},
|
||||
{Name: "TaintToleration"},
|
||||
},
|
||||
"ScorePlugin": {{Name: "TaintToleration", Weight: 2}},
|
||||
"ScorePlugin": {
|
||||
{Name: "ImageLocality", Weight: 2},
|
||||
{Name: "TaintToleration", Weight: 2},
|
||||
},
|
||||
},
|
||||
wantExtenders: []schedulerapi.ExtenderConfig{{
|
||||
URLPrefix: "/prefix",
|
||||
@@ -480,7 +488,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
),
|
||||
wantPrioritizers: sets.NewString(
|
||||
"EqualPriority",
|
||||
"ImageLocalityPriority",
|
||||
"LeastRequestedPriority",
|
||||
"BalancedResourceAllocation",
|
||||
"SelectorSpreadPriority",
|
||||
@@ -497,7 +504,10 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
{Name: "VolumeRestrictions"},
|
||||
{Name: "TaintToleration"},
|
||||
},
|
||||
"ScorePlugin": {{Name: "TaintToleration", Weight: 2}},
|
||||
"ScorePlugin": {
|
||||
{Name: "ImageLocality", Weight: 2},
|
||||
{Name: "TaintToleration", Weight: 2},
|
||||
},
|
||||
},
|
||||
wantExtenders: []schedulerapi.ExtenderConfig{{
|
||||
URLPrefix: "/prefix",
|
||||
@@ -575,7 +585,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
),
|
||||
wantPrioritizers: sets.NewString(
|
||||
"EqualPriority",
|
||||
"ImageLocalityPriority",
|
||||
"LeastRequestedPriority",
|
||||
"BalancedResourceAllocation",
|
||||
"SelectorSpreadPriority",
|
||||
@@ -593,7 +602,10 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
{Name: "TaintToleration"},
|
||||
{Name: "VolumeBinding"},
|
||||
},
|
||||
"ScorePlugin": {{Name: "TaintToleration", Weight: 2}},
|
||||
"ScorePlugin": {
|
||||
{Name: "ImageLocality", Weight: 2},
|
||||
{Name: "TaintToleration", Weight: 2},
|
||||
},
|
||||
},
|
||||
wantExtenders: []schedulerapi.ExtenderConfig{{
|
||||
URLPrefix: "/prefix",
|
||||
@@ -676,7 +688,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
),
|
||||
wantPrioritizers: sets.NewString(
|
||||
"EqualPriority",
|
||||
"ImageLocalityPriority",
|
||||
"LeastRequestedPriority",
|
||||
"BalancedResourceAllocation",
|
||||
"SelectorSpreadPriority",
|
||||
@@ -694,7 +705,10 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
{Name: "TaintToleration"},
|
||||
{Name: "VolumeBinding"},
|
||||
},
|
||||
"ScorePlugin": {{Name: "TaintToleration", Weight: 2}},
|
||||
"ScorePlugin": {
|
||||
{Name: "ImageLocality", Weight: 2},
|
||||
{Name: "TaintToleration", Weight: 2},
|
||||
},
|
||||
},
|
||||
wantExtenders: []schedulerapi.ExtenderConfig{{
|
||||
URLPrefix: "/prefix",
|
||||
@@ -789,7 +803,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
),
|
||||
wantPrioritizers: sets.NewString(
|
||||
"EqualPriority",
|
||||
"ImageLocalityPriority",
|
||||
"LeastRequestedPriority",
|
||||
"BalancedResourceAllocation",
|
||||
"SelectorSpreadPriority",
|
||||
@@ -808,7 +821,10 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
{Name: "TaintToleration"},
|
||||
{Name: "VolumeBinding"},
|
||||
},
|
||||
"ScorePlugin": {{Name: "TaintToleration", Weight: 2}},
|
||||
"ScorePlugin": {
|
||||
{Name: "ImageLocality", Weight: 2},
|
||||
{Name: "TaintToleration", Weight: 2},
|
||||
},
|
||||
},
|
||||
wantExtenders: []schedulerapi.ExtenderConfig{{
|
||||
URLPrefix: "/prefix",
|
||||
@@ -905,7 +921,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
),
|
||||
wantPrioritizers: sets.NewString(
|
||||
"EqualPriority",
|
||||
"ImageLocalityPriority",
|
||||
"LeastRequestedPriority",
|
||||
"BalancedResourceAllocation",
|
||||
"SelectorSpreadPriority",
|
||||
@@ -924,7 +939,10 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
{Name: "TaintToleration"},
|
||||
{Name: "VolumeBinding"},
|
||||
},
|
||||
"ScorePlugin": {{Name: "TaintToleration", Weight: 2}},
|
||||
"ScorePlugin": {
|
||||
{Name: "ImageLocality", Weight: 2},
|
||||
{Name: "TaintToleration", Weight: 2},
|
||||
},
|
||||
},
|
||||
wantExtenders: []schedulerapi.ExtenderConfig{{
|
||||
URLPrefix: "/prefix",
|
||||
@@ -1021,7 +1039,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
),
|
||||
wantPrioritizers: sets.NewString(
|
||||
"EqualPriority",
|
||||
"ImageLocalityPriority",
|
||||
"LeastRequestedPriority",
|
||||
"BalancedResourceAllocation",
|
||||
"SelectorSpreadPriority",
|
||||
@@ -1040,7 +1057,10 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
{Name: "TaintToleration"},
|
||||
{Name: "VolumeBinding"},
|
||||
},
|
||||
"ScorePlugin": {{Name: "TaintToleration", Weight: 2}},
|
||||
"ScorePlugin": {
|
||||
{Name: "ImageLocality", Weight: 2},
|
||||
{Name: "TaintToleration", Weight: 2},
|
||||
},
|
||||
},
|
||||
wantExtenders: []schedulerapi.ExtenderConfig{{
|
||||
URLPrefix: "/prefix",
|
||||
@@ -1141,7 +1161,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
),
|
||||
wantPrioritizers: sets.NewString(
|
||||
"EqualPriority",
|
||||
"ImageLocalityPriority",
|
||||
"LeastRequestedPriority",
|
||||
"BalancedResourceAllocation",
|
||||
"SelectorSpreadPriority",
|
||||
@@ -1160,7 +1179,10 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
{Name: "TaintToleration"},
|
||||
{Name: "VolumeBinding"},
|
||||
},
|
||||
"ScorePlugin": {{Name: "TaintToleration", Weight: 2}},
|
||||
"ScorePlugin": {
|
||||
{Name: "ImageLocality", Weight: 2},
|
||||
{Name: "TaintToleration", Weight: 2},
|
||||
},
|
||||
},
|
||||
wantExtenders: []schedulerapi.ExtenderConfig{{
|
||||
URLPrefix: "/prefix",
|
||||
@@ -1192,6 +1214,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
}
|
||||
scoreToPriorityMap := map[string]string{
|
||||
"TaintToleration": "TaintTolerationPriority",
|
||||
"ImageLocality": "ImageLocalityPriority",
|
||||
}
|
||||
|
||||
for v, tc := range schedulerFiles {
|
||||
@@ -1245,7 +1268,7 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
||||
seenPredicates.Insert(filterToPredicateMap[p.Name])
|
||||
|
||||
}
|
||||
for _, p := range gotPlugins["FilterPlugin"] {
|
||||
for _, p := range gotPlugins["ScorePlugin"] {
|
||||
seenPriorities.Insert(scoreToPriorityMap[p.Name])
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user