diff --git a/api/swagger-spec/v1.json b/api/swagger-spec/v1.json index bbe8c836869..71243116188 100644 --- a/api/swagger-spec/v1.json +++ b/api/swagger-spec/v1.json @@ -15609,17 +15609,17 @@ "id": "v1.ContainerImage", "description": "Describe a container image", "required": [ - "repoTags" + "names" ], "properties": { - "repoTags": { + "names": { "type": "array", "items": { "type": "string" }, "description": "Names by which this image is known. e.g. [\"gcr.io/google_containers/hyperkube:v1.0.7\", \"dockerhub.io/google_containers/hyperkube:v1.0.7\"]" }, - "size": { + "sizeBytes": { "type": "integer", "format": "int64", "description": "The size of the image in bytes." diff --git a/docs/api-reference/v1/definitions.html b/docs/api-reference/v1/definitions.html index 3af45017f53..6ff5b296c56 100755 --- a/docs/api-reference/v1/definitions.html +++ b/docs/api-reference/v1/definitions.html @@ -6172,14 +6172,14 @@ The resulting set of endpoints can be viewed as:
-

repoTags

+

names

Names by which this image is known. e.g. ["gcr.io/google_containers/hyperkube:v1.0.7", "dockerhub.io/google_containers/hyperkube:v1.0.7"]

true

string array

-

size

+

sizeBytes

The size of the image in bytes.

false

integer (int64)

@@ -7477,7 +7477,7 @@ The resulting set of endpoints can be viewed as:
diff --git a/pkg/api/deep_copy_generated.go b/pkg/api/deep_copy_generated.go index e2724ce0dac..ab938aac57e 100644 --- a/pkg/api/deep_copy_generated.go +++ b/pkg/api/deep_copy_generated.go @@ -496,14 +496,14 @@ func DeepCopy_api_Container(in Container, out *Container, c *conversion.Cloner) } func DeepCopy_api_ContainerImage(in ContainerImage, out *ContainerImage, c *conversion.Cloner) error { - if in.RepoTags != nil { - in, out := in.RepoTags, &out.RepoTags + if in.Names != nil { + in, out := in.Names, &out.Names *out = make([]string, len(in)) copy(*out, in) } else { - out.RepoTags = nil + out.Names = nil } - out.Size = in.Size + out.SizeBytes = in.SizeBytes return nil } diff --git a/pkg/api/types.generated.go b/pkg/api/types.generated.go index d7c86fce9b8..1d5f537f811 100644 --- a/pkg/api/types.generated.go +++ b/pkg/api/types.generated.go @@ -33754,7 +33754,7 @@ func (x *ContainerImage) CodecEncodeSelf(e *codec1978.Encoder) { var yyq2 [2]bool _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false - yyq2[1] = x.Size != 0 + yyq2[1] = x.SizeBytes != 0 var yynn2 int if yyr2 || yy2arr2 { r.EncodeArrayStart(2) @@ -33770,28 +33770,28 @@ func (x *ContainerImage) CodecEncodeSelf(e *codec1978.Encoder) { } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - if x.RepoTags == nil { + if x.Names == nil { r.EncodeNil() } else { yym4 := z.EncBinary() _ = yym4 if false { } else { - z.F.EncSliceStringV(x.RepoTags, false, e) + z.F.EncSliceStringV(x.Names, false, e) } } } else { z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("repoTags")) + r.EncodeString(codecSelferC_UTF81234, string("names")) z.EncSendContainerState(codecSelfer_containerMapValue1234) - if x.RepoTags == nil { + if x.Names == nil { r.EncodeNil() } else { yym5 := z.EncBinary() _ = yym5 if false { } else { - z.F.EncSliceStringV(x.RepoTags, false, e) + z.F.EncSliceStringV(x.Names, false, e) } } } @@ -33802,7 +33802,7 @@ func (x *ContainerImage) CodecEncodeSelf(e *codec1978.Encoder) { _ = yym7 if false { } else { - r.EncodeInt(int64(x.Size)) + r.EncodeInt(int64(x.SizeBytes)) } } else { r.EncodeInt(0) @@ -33810,13 +33810,13 @@ func (x *ContainerImage) CodecEncodeSelf(e *codec1978.Encoder) { } else { if yyq2[1] { z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("size")) + r.EncodeString(codecSelferC_UTF81234, string("sizeBytes")) z.EncSendContainerState(codecSelfer_containerMapValue1234) yym8 := z.EncBinary() _ = yym8 if false { } else { - r.EncodeInt(int64(x.Size)) + r.EncodeInt(int64(x.SizeBytes)) } } } @@ -33881,11 +33881,11 @@ func (x *ContainerImage) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { yys3 := string(yys3Slc) z.DecSendContainerState(codecSelfer_containerMapValue1234) switch yys3 { - case "repoTags": + case "names": if r.TryDecodeAsNil() { - x.RepoTags = nil + x.Names = nil } else { - yyv4 := &x.RepoTags + yyv4 := &x.Names yym5 := z.DecBinary() _ = yym5 if false { @@ -33893,11 +33893,11 @@ func (x *ContainerImage) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { z.F.DecSliceStringX(yyv4, false, d) } } - case "size": + case "sizeBytes": if r.TryDecodeAsNil() { - x.Size = 0 + x.SizeBytes = 0 } else { - x.Size = int64(r.DecodeInt(64)) + x.SizeBytes = int64(r.DecodeInt(64)) } default: z.DecStructFieldNotFound(-1, yys3) @@ -33925,9 +33925,9 @@ func (x *ContainerImage) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.RepoTags = nil + x.Names = nil } else { - yyv8 := &x.RepoTags + yyv8 := &x.Names yym9 := z.DecBinary() _ = yym9 if false { @@ -33947,9 +33947,9 @@ func (x *ContainerImage) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.Size = 0 + x.SizeBytes = 0 } else { - x.Size = int64(r.DecodeInt(64)) + x.SizeBytes = int64(r.DecodeInt(64)) } for { yyj7++ diff --git a/pkg/api/types.go b/pkg/api/types.go index eb6afeaaef4..1312ef08691 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -1719,9 +1719,9 @@ type NodeStatus struct { // Describe a container image type ContainerImage struct { // Names by which this image is known. - RepoTags []string `json:"repoTags"` + Names []string `json:"names"` // The size of the image in bytes. - Size int64 `json:"size,omitempty"` + SizeBytes int64 `json:"sizeBytes,omitempty"` } type NodePhase string diff --git a/pkg/api/v1/conversion_generated.go b/pkg/api/v1/conversion_generated.go index 88d94445cb4..a0e405e9e88 100644 --- a/pkg/api/v1/conversion_generated.go +++ b/pkg/api/v1/conversion_generated.go @@ -403,15 +403,15 @@ func autoConvert_api_ContainerImage_To_v1_ContainerImage(in *api.ContainerImage, if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.ContainerImage))(in) } - if in.RepoTags != nil { - out.RepoTags = make([]string, len(in.RepoTags)) - for i := range in.RepoTags { - out.RepoTags[i] = in.RepoTags[i] + if in.Names != nil { + out.Names = make([]string, len(in.Names)) + for i := range in.Names { + out.Names[i] = in.Names[i] } } else { - out.RepoTags = nil + out.Names = nil } - out.Size = in.Size + out.SizeBytes = in.SizeBytes return nil } @@ -3699,15 +3699,15 @@ func autoConvert_v1_ContainerImage_To_api_ContainerImage(in *ContainerImage, out if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*ContainerImage))(in) } - if in.RepoTags != nil { - out.RepoTags = make([]string, len(in.RepoTags)) - for i := range in.RepoTags { - out.RepoTags[i] = in.RepoTags[i] + if in.Names != nil { + out.Names = make([]string, len(in.Names)) + for i := range in.Names { + out.Names[i] = in.Names[i] } } else { - out.RepoTags = nil + out.Names = nil } - out.Size = in.Size + out.SizeBytes = in.SizeBytes return nil } diff --git a/pkg/api/v1/deep_copy_generated.go b/pkg/api/v1/deep_copy_generated.go index 2d324187b4e..f6aaedc88cf 100644 --- a/pkg/api/v1/deep_copy_generated.go +++ b/pkg/api/v1/deep_copy_generated.go @@ -349,15 +349,15 @@ func deepCopy_v1_Container(in Container, out *Container, c *conversion.Cloner) e } func deepCopy_v1_ContainerImage(in ContainerImage, out *ContainerImage, c *conversion.Cloner) error { - if in.RepoTags != nil { - out.RepoTags = make([]string, len(in.RepoTags)) - for i := range in.RepoTags { - out.RepoTags[i] = in.RepoTags[i] + if in.Names != nil { + out.Names = make([]string, len(in.Names)) + for i := range in.Names { + out.Names[i] = in.Names[i] } } else { - out.RepoTags = nil + out.Names = nil } - out.Size = in.Size + out.SizeBytes = in.SizeBytes return nil } diff --git a/pkg/api/v1/types.generated.go b/pkg/api/v1/types.generated.go index 882d4bb06d0..18ae2139a4d 100644 --- a/pkg/api/v1/types.generated.go +++ b/pkg/api/v1/types.generated.go @@ -33636,7 +33636,7 @@ func (x *ContainerImage) CodecEncodeSelf(e *codec1978.Encoder) { var yyq2 [2]bool _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false - yyq2[1] = x.Size != 0 + yyq2[1] = x.SizeBytes != 0 var yynn2 int if yyr2 || yy2arr2 { r.EncodeArrayStart(2) @@ -33652,28 +33652,28 @@ func (x *ContainerImage) CodecEncodeSelf(e *codec1978.Encoder) { } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - if x.RepoTags == nil { + if x.Names == nil { r.EncodeNil() } else { yym4 := z.EncBinary() _ = yym4 if false { } else { - z.F.EncSliceStringV(x.RepoTags, false, e) + z.F.EncSliceStringV(x.Names, false, e) } } } else { z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("repoTags")) + r.EncodeString(codecSelferC_UTF81234, string("names")) z.EncSendContainerState(codecSelfer_containerMapValue1234) - if x.RepoTags == nil { + if x.Names == nil { r.EncodeNil() } else { yym5 := z.EncBinary() _ = yym5 if false { } else { - z.F.EncSliceStringV(x.RepoTags, false, e) + z.F.EncSliceStringV(x.Names, false, e) } } } @@ -33684,7 +33684,7 @@ func (x *ContainerImage) CodecEncodeSelf(e *codec1978.Encoder) { _ = yym7 if false { } else { - r.EncodeInt(int64(x.Size)) + r.EncodeInt(int64(x.SizeBytes)) } } else { r.EncodeInt(0) @@ -33692,13 +33692,13 @@ func (x *ContainerImage) CodecEncodeSelf(e *codec1978.Encoder) { } else { if yyq2[1] { z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("size")) + r.EncodeString(codecSelferC_UTF81234, string("sizeBytes")) z.EncSendContainerState(codecSelfer_containerMapValue1234) yym8 := z.EncBinary() _ = yym8 if false { } else { - r.EncodeInt(int64(x.Size)) + r.EncodeInt(int64(x.SizeBytes)) } } } @@ -33763,11 +33763,11 @@ func (x *ContainerImage) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { yys3 := string(yys3Slc) z.DecSendContainerState(codecSelfer_containerMapValue1234) switch yys3 { - case "repoTags": + case "names": if r.TryDecodeAsNil() { - x.RepoTags = nil + x.Names = nil } else { - yyv4 := &x.RepoTags + yyv4 := &x.Names yym5 := z.DecBinary() _ = yym5 if false { @@ -33775,11 +33775,11 @@ func (x *ContainerImage) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { z.F.DecSliceStringX(yyv4, false, d) } } - case "size": + case "sizeBytes": if r.TryDecodeAsNil() { - x.Size = 0 + x.SizeBytes = 0 } else { - x.Size = int64(r.DecodeInt(64)) + x.SizeBytes = int64(r.DecodeInt(64)) } default: z.DecStructFieldNotFound(-1, yys3) @@ -33807,9 +33807,9 @@ func (x *ContainerImage) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.RepoTags = nil + x.Names = nil } else { - yyv8 := &x.RepoTags + yyv8 := &x.Names yym9 := z.DecBinary() _ = yym9 if false { @@ -33829,9 +33829,9 @@ func (x *ContainerImage) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } z.DecSendContainerState(codecSelfer_containerArrayElem1234) if r.TryDecodeAsNil() { - x.Size = 0 + x.SizeBytes = 0 } else { - x.Size = int64(r.DecodeInt(64)) + x.SizeBytes = int64(r.DecodeInt(64)) } for { yyj7++ diff --git a/pkg/api/v1/types.go b/pkg/api/v1/types.go index 3c34a6db389..ad4686ec94b 100644 --- a/pkg/api/v1/types.go +++ b/pkg/api/v1/types.go @@ -2105,9 +2105,9 @@ type NodeStatus struct { type ContainerImage struct { // Names by which this image is known. // e.g. ["gcr.io/google_containers/hyperkube:v1.0.7", "dockerhub.io/google_containers/hyperkube:v1.0.7"] - RepoTags []string `json:"repoTags"` + Names []string `json:"names"` // The size of the image in bytes. - Size int64 `json:"size,omitempty"` + SizeBytes int64 `json:"sizeBytes,omitempty"` } type NodePhase string diff --git a/pkg/api/v1/types_swagger_doc_generated.go b/pkg/api/v1/types_swagger_doc_generated.go index 15cc2c616bf..4a7bd2dba37 100644 --- a/pkg/api/v1/types_swagger_doc_generated.go +++ b/pkg/api/v1/types_swagger_doc_generated.go @@ -201,9 +201,9 @@ func (Container) SwaggerDoc() map[string]string { } var map_ContainerImage = map[string]string{ - "": "Describe a container image", - "repoTags": "Names by which this image is known. e.g. [\"gcr.io/google_containers/hyperkube:v1.0.7\", \"dockerhub.io/google_containers/hyperkube:v1.0.7\"]", - "size": "The size of the image in bytes.", + "": "Describe a container image", + "names": "Names by which this image is known. e.g. [\"gcr.io/google_containers/hyperkube:v1.0.7\", \"dockerhub.io/google_containers/hyperkube:v1.0.7\"]", + "sizeBytes": "The size of the image in bytes.", } func (ContainerImage) SwaggerDoc() map[string]string { diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 40fc96a3528..48cbbca2249 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -2842,8 +2842,8 @@ func (kl *Kubelet) setNodeStatusImages(node *api.Node) { } else { for _, image := range containerImages { imagesOnNode = append(imagesOnNode, api.ContainerImage{ - RepoTags: image.RepoTags, - Size: image.Size, + Names: image.RepoTags, + SizeBytes: image.Size, }) } } diff --git a/pkg/kubelet/kubelet_test.go b/pkg/kubelet/kubelet_test.go index 5544db5fe02..3fb742e1e85 100644 --- a/pkg/kubelet/kubelet_test.go +++ b/pkg/kubelet/kubelet_test.go @@ -2723,12 +2723,12 @@ func TestUpdateNewNodeStatus(t *testing.T) { }, Images: []api.ContainerImage{ { - RepoTags: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"}, - Size: 123, + Names: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"}, + SizeBytes: 123, }, { - RepoTags: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"}, - Size: 456, + Names: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"}, + SizeBytes: 456, }, }, }, @@ -2958,12 +2958,12 @@ func TestDockerRuntimeVersion(t *testing.T) { }, Images: []api.ContainerImage{ { - RepoTags: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"}, - Size: 123, + Names: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"}, + SizeBytes: 123, }, { - RepoTags: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"}, - Size: 456, + Names: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"}, + SizeBytes: 456, }, }, }, @@ -3142,12 +3142,12 @@ func TestUpdateExistingNodeStatus(t *testing.T) { }, Images: []api.ContainerImage{ { - RepoTags: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"}, - Size: 123, + Names: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"}, + SizeBytes: 123, }, { - RepoTags: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"}, - Size: 456, + Names: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"}, + SizeBytes: 456, }, }, }, @@ -3422,12 +3422,12 @@ func TestUpdateNodeStatusWithoutContainerRuntime(t *testing.T) { }, Images: []api.ContainerImage{ { - RepoTags: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"}, - Size: 123, + Names: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"}, + SizeBytes: 123, }, { - RepoTags: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"}, - Size: 456, + Names: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"}, + SizeBytes: 456, }, }, }, diff --git a/plugin/pkg/scheduler/algorithm/priorities/priorities.go b/plugin/pkg/scheduler/algorithm/priorities/priorities.go index 48584c5a7ba..b6fb21cb2e1 100644 --- a/plugin/pkg/scheduler/algorithm/priorities/priorities.go +++ b/plugin/pkg/scheduler/algorithm/priorities/priorities.go @@ -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 } } } diff --git a/plugin/pkg/scheduler/algorithm/priorities/priorities_test.go b/plugin/pkg/scheduler/algorithm/priorities/priorities_test.go index eda51aab5bc..65814cb0cb7 100644 --- a/plugin/pkg/scheduler/algorithm/priorities/priorities_test.go +++ b/plugin/pkg/scheduler/algorithm/priorities/priorities_test.go @@ -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), }, }, }