Improve the naming of fields in ContainerImage struct used in NodeStatus.
Signed-off-by: Vishnu kannan <vishnuk@google.com>
This commit is contained in:
@@ -183,10 +183,10 @@ func ImageLocalityPriority(pod *api.Pod, nodeNameToInfo map[string]*schedulercac
|
||||
// checkContainerImageOnNode checks if a container image is present on a node and returns its size.
|
||||
func checkContainerImageOnNode(node api.Node, container api.Container) int64 {
|
||||
for _, image := range node.Status.Images {
|
||||
for _, repoTag := range image.RepoTags {
|
||||
if container.Image == repoTag {
|
||||
for _, name := range image.Names {
|
||||
if container.Image == name {
|
||||
// Should return immediately.
|
||||
return image.Size
|
||||
return image.SizeBytes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -767,25 +767,25 @@ func TestImageLocalityPriority(t *testing.T) {
|
||||
node_40_140_2000 := api.NodeStatus{
|
||||
Images: []api.ContainerImage{
|
||||
{
|
||||
RepoTags: []string{
|
||||
Names: []string{
|
||||
"gcr.io/40",
|
||||
"gcr.io/40:v1",
|
||||
"gcr.io/40:v1",
|
||||
},
|
||||
Size: int64(40 * mb),
|
||||
SizeBytes: int64(40 * mb),
|
||||
},
|
||||
{
|
||||
RepoTags: []string{
|
||||
Names: []string{
|
||||
"gcr.io/140",
|
||||
"gcr.io/140:v1",
|
||||
},
|
||||
Size: int64(140 * mb),
|
||||
SizeBytes: int64(140 * mb),
|
||||
},
|
||||
{
|
||||
RepoTags: []string{
|
||||
Names: []string{
|
||||
"gcr.io/2000",
|
||||
},
|
||||
Size: int64(2000 * mb),
|
||||
SizeBytes: int64(2000 * mb),
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -793,17 +793,17 @@ func TestImageLocalityPriority(t *testing.T) {
|
||||
node_250_10 := api.NodeStatus{
|
||||
Images: []api.ContainerImage{
|
||||
{
|
||||
RepoTags: []string{
|
||||
Names: []string{
|
||||
"gcr.io/250",
|
||||
},
|
||||
Size: int64(250 * mb),
|
||||
SizeBytes: int64(250 * mb),
|
||||
},
|
||||
{
|
||||
RepoTags: []string{
|
||||
Names: []string{
|
||||
"gcr.io/10",
|
||||
"gcr.io/10:v1",
|
||||
},
|
||||
Size: int64(10 * mb),
|
||||
SizeBytes: int64(10 * mb),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user