mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 19:23:40 +00:00
Expose the issue that max threshold haven't considered container size
Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
parent
1d365a8cad
commit
84915d1623
@ -64,6 +64,20 @@ func TestImageLocalityPriority(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test300600900 := v1.PodSpec{
|
||||||
|
Containers: []v1.Container{
|
||||||
|
{
|
||||||
|
Image: "gcr.io/300",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Image: "gcr.io/600",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Image: "gcr.io/900",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
node403002000 := v1.NodeStatus{
|
node403002000 := v1.NodeStatus{
|
||||||
Images: []v1.ContainerImage{
|
Images: []v1.ContainerImage{
|
||||||
{
|
{
|
||||||
@ -108,6 +122,52 @@ func TestImageLocalityPriority(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
node60040900 := v1.NodeStatus{
|
||||||
|
Images: []v1.ContainerImage{
|
||||||
|
{
|
||||||
|
Names: []string{
|
||||||
|
"gcr.io/600:" + parsers.DefaultImageTag,
|
||||||
|
},
|
||||||
|
SizeBytes: int64(600 * mb),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Names: []string{
|
||||||
|
"gcr.io/40:" + parsers.DefaultImageTag,
|
||||||
|
},
|
||||||
|
SizeBytes: int64(40 * mb),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Names: []string{
|
||||||
|
"gcr.io/900:" + parsers.DefaultImageTag,
|
||||||
|
},
|
||||||
|
SizeBytes: int64(900 * mb),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
node300600900 := v1.NodeStatus{
|
||||||
|
Images: []v1.ContainerImage{
|
||||||
|
{
|
||||||
|
Names: []string{
|
||||||
|
"gcr.io/300:" + parsers.DefaultImageTag,
|
||||||
|
},
|
||||||
|
SizeBytes: int64(300 * mb),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Names: []string{
|
||||||
|
"gcr.io/600:" + parsers.DefaultImageTag,
|
||||||
|
},
|
||||||
|
SizeBytes: int64(600 * mb),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Names: []string{
|
||||||
|
"gcr.io/900:" + parsers.DefaultImageTag,
|
||||||
|
},
|
||||||
|
SizeBytes: int64(900 * mb),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
nodeWithNoImages := v1.NodeStatus{}
|
nodeWithNoImages := v1.NodeStatus{}
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
@ -181,6 +241,25 @@ func TestImageLocalityPriority(t *testing.T) {
|
|||||||
expectedList: []framework.NodeScore{{Name: "machine1", Score: 65}, {Name: "machine2", Score: 0}, {Name: "machine3", Score: 0}},
|
expectedList: []framework.NodeScore{{Name: "machine1", Score: 65}, {Name: "machine2", Score: 0}, {Name: "machine3", Score: 0}},
|
||||||
name: "if exceed limit, use limit (with node which has no images present)",
|
name: "if exceed limit, use limit (with node which has no images present)",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// Pod: gcr.io/300 gcr.io/600 gcr.io/900
|
||||||
|
|
||||||
|
// Node1
|
||||||
|
// Image: gcr.io/600:latest 600MB, gcr.io/900:latest 900MB
|
||||||
|
// Score: 100 (600M * 2/3 + 900M * 2/3 = 1000M >= 1000M, max-threshold)
|
||||||
|
|
||||||
|
// Node2
|
||||||
|
// Image: gcr.io/300:latest 300MB, gcr.io/600:latest 600MB, gcr.io/900:latest 900MB
|
||||||
|
// Score: 100 (300M * 1/3 + 600M * 2/3 + 900M * 2/3) >= 1000M, max-threshold)
|
||||||
|
|
||||||
|
// Node3
|
||||||
|
// Image:
|
||||||
|
// Score: 0
|
||||||
|
pod: &v1.Pod{Spec: test300600900},
|
||||||
|
nodes: []*v1.Node{makeImageNode("machine1", node60040900), makeImageNode("machine2", node300600900), makeImageNode("machine3", nodeWithNoImages)},
|
||||||
|
expectedList: []framework.NodeScore{{Name: "machine1", Score: 100}, {Name: "machine2", Score: 100}, {Name: "machine3", Score: 0}},
|
||||||
|
name: "max threshold haven't considered the size of containers to be run for the pod",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
Loading…
Reference in New Issue
Block a user