mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Merge pull request #18248 from resouer/images-dev
Auto commit by PR queue bot
This commit is contained in:
commit
c255181509
@ -13503,6 +13503,9 @@
|
||||
"v1.NodeStatus": {
|
||||
"id": "v1.NodeStatus",
|
||||
"description": "NodeStatus is information about the current status of a node.",
|
||||
"required": [
|
||||
"images"
|
||||
],
|
||||
"properties": {
|
||||
"capacity": {
|
||||
"type": "any",
|
||||
@ -13537,6 +13540,13 @@
|
||||
"nodeInfo": {
|
||||
"$ref": "v1.NodeSystemInfo",
|
||||
"description": "Set of ids/uuids to uniquely identify the node. More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-info"
|
||||
},
|
||||
"images": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "v1.ContainerImage"
|
||||
},
|
||||
"description": "List of container images on this node"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -13664,6 +13674,27 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.ContainerImage": {
|
||||
"id": "v1.ContainerImage",
|
||||
"description": "Describe a container image",
|
||||
"required": [
|
||||
"repoTags"
|
||||
],
|
||||
"properties": {
|
||||
"repoTags": {
|
||||
"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": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "The size of the image in bytes."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.PersistentVolumeClaimList": {
|
||||
"id": "v1.PersistentVolumeClaimList",
|
||||
"description": "PersistentVolumeClaimList is a list of PersistentVolumeClaim items.",
|
||||
|
@ -3906,6 +3906,13 @@ The resulting set of endpoints can be viewed as:<br>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_nodesysteminfo">v1.NodeSystemInfo</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">images</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">List of container images on this node</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_containerimage">v1.ContainerImage</a> array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -5753,6 +5760,47 @@ The resulting set of endpoints can be viewed as:<br>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_containerimage">v1.ContainerImage</h3>
|
||||
<div class="paragraph">
|
||||
<p>Describe a container image</p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all" style="width:100%; ">
|
||||
<colgroup>
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
<col style="width:20%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tableblock halign-left valign-top">Name</th>
|
||||
<th class="tableblock halign-left valign-top">Description</th>
|
||||
<th class="tableblock halign-left valign-top">Required</th>
|
||||
<th class="tableblock halign-left valign-top">Schema</th>
|
||||
<th class="tableblock halign-left valign-top">Default</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">repoTags</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">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"]</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string array</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">size</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">The size of the image in bytes.</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">integer (int64)</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_replicationcontrollerlist">v1.ReplicationControllerList</h3>
|
||||
@ -7001,7 +7049,7 @@ The resulting set of endpoints can be viewed as:<br>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2015-12-29 09:07:07 UTC
|
||||
Last updated 2016-01-08 09:05:37 UTC
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -40,6 +40,7 @@ func init() {
|
||||
deepCopy_api_ComponentStatus,
|
||||
deepCopy_api_ComponentStatusList,
|
||||
deepCopy_api_Container,
|
||||
deepCopy_api_ContainerImage,
|
||||
deepCopy_api_ContainerPort,
|
||||
deepCopy_api_ContainerState,
|
||||
deepCopy_api_ContainerStateRunning,
|
||||
@ -392,6 +393,18 @@ func deepCopy_api_Container(in Container, out *Container, c *conversion.Cloner)
|
||||
return nil
|
||||
}
|
||||
|
||||
func deepCopy_api_ContainerImage(in ContainerImage, out *ContainerImage, c *conversion.Cloner) error {
|
||||
if in.RepoTags != nil {
|
||||
in, out := in.RepoTags, &out.RepoTags
|
||||
*out = make([]string, len(in))
|
||||
copy(*out, in)
|
||||
} else {
|
||||
out.RepoTags = nil
|
||||
}
|
||||
out.Size = in.Size
|
||||
return nil
|
||||
}
|
||||
|
||||
func deepCopy_api_ContainerPort(in ContainerPort, out *ContainerPort, c *conversion.Cloner) error {
|
||||
out.Name = in.Name
|
||||
out.HostPort = in.HostPort
|
||||
@ -1304,6 +1317,17 @@ func deepCopy_api_NodeStatus(in NodeStatus, out *NodeStatus, c *conversion.Clone
|
||||
if err := deepCopy_api_NodeSystemInfo(in.NodeInfo, &out.NodeInfo, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if in.Images != nil {
|
||||
in, out := in.Images, &out.Images
|
||||
*out = make([]ContainerImage, len(in))
|
||||
for i := range in {
|
||||
if err := deepCopy_api_ContainerImage(in[i], &(*out)[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Images = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1544,6 +1544,16 @@ type NodeStatus struct {
|
||||
DaemonEndpoints NodeDaemonEndpoints `json:"daemonEndpoints,omitempty"`
|
||||
// Set of ids/uuids to uniquely identify the node.
|
||||
NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"`
|
||||
// List of container images on this node
|
||||
Images []ContainerImage `json:"images",omitempty`
|
||||
}
|
||||
|
||||
// Describe a container image
|
||||
type ContainerImage struct {
|
||||
// Names by which this image is known.
|
||||
RepoTags []string `json:"repoTags"`
|
||||
// The size of the image in bytes.
|
||||
Size int64 `json:"size,omitempty"`
|
||||
}
|
||||
|
||||
type NodePhase string
|
||||
|
@ -307,6 +307,26 @@ func Convert_api_Container_To_v1_Container(in *api.Container, out *Container, s
|
||||
return autoConvert_api_Container_To_v1_Container(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_api_ContainerImage_To_v1_ContainerImage(in *api.ContainerImage, out *ContainerImage, s conversion.Scope) error {
|
||||
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]
|
||||
}
|
||||
} else {
|
||||
out.RepoTags = nil
|
||||
}
|
||||
out.Size = in.Size
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_api_ContainerImage_To_v1_ContainerImage(in *api.ContainerImage, out *ContainerImage, s conversion.Scope) error {
|
||||
return autoConvert_api_ContainerImage_To_v1_ContainerImage(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_api_ContainerPort_To_v1_ContainerPort(in *api.ContainerPort, out *ContainerPort, s conversion.Scope) error {
|
||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||
defaulting.(func(*api.ContainerPort))(in)
|
||||
@ -1500,6 +1520,16 @@ func autoConvert_api_NodeStatus_To_v1_NodeStatus(in *api.NodeStatus, out *NodeSt
|
||||
if err := Convert_api_NodeSystemInfo_To_v1_NodeSystemInfo(&in.NodeInfo, &out.NodeInfo, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if in.Images != nil {
|
||||
out.Images = make([]ContainerImage, len(in.Images))
|
||||
for i := range in.Images {
|
||||
if err := Convert_api_ContainerImage_To_v1_ContainerImage(&in.Images[i], &out.Images[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Images = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -3466,6 +3496,26 @@ func Convert_v1_Container_To_api_Container(in *Container, out *api.Container, s
|
||||
return autoConvert_v1_Container_To_api_Container(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_ContainerImage_To_api_ContainerImage(in *ContainerImage, out *api.ContainerImage, s conversion.Scope) error {
|
||||
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]
|
||||
}
|
||||
} else {
|
||||
out.RepoTags = nil
|
||||
}
|
||||
out.Size = in.Size
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1_ContainerImage_To_api_ContainerImage(in *ContainerImage, out *api.ContainerImage, s conversion.Scope) error {
|
||||
return autoConvert_v1_ContainerImage_To_api_ContainerImage(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_ContainerPort_To_api_ContainerPort(in *ContainerPort, out *api.ContainerPort, s conversion.Scope) error {
|
||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||
defaulting.(func(*ContainerPort))(in)
|
||||
@ -4612,6 +4662,16 @@ func autoConvert_v1_NodeStatus_To_api_NodeStatus(in *NodeStatus, out *api.NodeSt
|
||||
if err := Convert_v1_NodeSystemInfo_To_api_NodeSystemInfo(&in.NodeInfo, &out.NodeInfo, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if in.Images != nil {
|
||||
out.Images = make([]api.ContainerImage, len(in.Images))
|
||||
for i := range in.Images {
|
||||
if err := Convert_v1_ContainerImage_To_api_ContainerImage(&in.Images[i], &out.Images[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Images = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -6232,6 +6292,7 @@ func init() {
|
||||
autoConvert_api_ComponentCondition_To_v1_ComponentCondition,
|
||||
autoConvert_api_ComponentStatusList_To_v1_ComponentStatusList,
|
||||
autoConvert_api_ComponentStatus_To_v1_ComponentStatus,
|
||||
autoConvert_api_ContainerImage_To_v1_ContainerImage,
|
||||
autoConvert_api_ContainerPort_To_v1_ContainerPort,
|
||||
autoConvert_api_ContainerStateRunning_To_v1_ContainerStateRunning,
|
||||
autoConvert_api_ContainerStateTerminated_To_v1_ContainerStateTerminated,
|
||||
@ -6352,6 +6413,7 @@ func init() {
|
||||
autoConvert_v1_ComponentCondition_To_api_ComponentCondition,
|
||||
autoConvert_v1_ComponentStatusList_To_api_ComponentStatusList,
|
||||
autoConvert_v1_ComponentStatus_To_api_ComponentStatus,
|
||||
autoConvert_v1_ContainerImage_To_api_ContainerImage,
|
||||
autoConvert_v1_ContainerPort_To_api_ContainerPort,
|
||||
autoConvert_v1_ContainerStateRunning_To_api_ContainerStateRunning,
|
||||
autoConvert_v1_ContainerStateTerminated_To_api_ContainerStateTerminated,
|
||||
|
@ -277,6 +277,19 @@ func deepCopy_v1_Container(in Container, out *Container, c *conversion.Cloner) e
|
||||
return nil
|
||||
}
|
||||
|
||||
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]
|
||||
}
|
||||
} else {
|
||||
out.RepoTags = nil
|
||||
}
|
||||
out.Size = in.Size
|
||||
return nil
|
||||
}
|
||||
|
||||
func deepCopy_v1_ContainerPort(in ContainerPort, out *ContainerPort, c *conversion.Cloner) error {
|
||||
out.Name = in.Name
|
||||
out.HostPort = in.HostPort
|
||||
@ -1096,6 +1109,16 @@ func deepCopy_v1_NodeStatus(in NodeStatus, out *NodeStatus, c *conversion.Cloner
|
||||
if err := deepCopy_v1_NodeSystemInfo(in.NodeInfo, &out.NodeInfo, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if in.Images != nil {
|
||||
out.Images = make([]ContainerImage, len(in.Images))
|
||||
for i := range in.Images {
|
||||
if err := deepCopy_v1_ContainerImage(in.Images[i], &out.Images[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Images = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -2441,6 +2464,7 @@ func init() {
|
||||
deepCopy_v1_ComponentStatus,
|
||||
deepCopy_v1_ComponentStatusList,
|
||||
deepCopy_v1_Container,
|
||||
deepCopy_v1_ContainerImage,
|
||||
deepCopy_v1_ContainerPort,
|
||||
deepCopy_v1_ContainerState,
|
||||
deepCopy_v1_ContainerStateRunning,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1911,6 +1911,17 @@ type NodeStatus struct {
|
||||
// Set of ids/uuids to uniquely identify the node.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-info
|
||||
NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"`
|
||||
// List of container images on this node
|
||||
Images []ContainerImage `json:"images",omitempty`
|
||||
}
|
||||
|
||||
// Describe a container image
|
||||
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"`
|
||||
// The size of the image in bytes.
|
||||
Size int64 `json:"size,omitempty"`
|
||||
}
|
||||
|
||||
type NodePhase string
|
||||
|
@ -141,6 +141,16 @@ func (Container) SwaggerDoc() map[string]string {
|
||||
return map_Container
|
||||
}
|
||||
|
||||
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.",
|
||||
}
|
||||
|
||||
func (ContainerImage) SwaggerDoc() map[string]string {
|
||||
return map_ContainerImage
|
||||
}
|
||||
|
||||
var map_ContainerPort = map[string]string{
|
||||
"": "ContainerPort represents a network port in a single container.",
|
||||
"name": "If specified, this must be an IANA_SVC_NAME and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.",
|
||||
@ -732,6 +742,7 @@ var map_NodeStatus = map[string]string{
|
||||
"addresses": "List of addresses reachable to the node. Queried from cloud provider, if available. More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-addresses",
|
||||
"daemonEndpoints": "Endpoints of daemons running on the Node.",
|
||||
"nodeInfo": "Set of ids/uuids to uniquely identify the node. More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-info",
|
||||
"images": "List of container images on this node",
|
||||
}
|
||||
|
||||
func (NodeStatus) SwaggerDoc() map[string]string {
|
||||
|
@ -329,7 +329,7 @@ type Image struct {
|
||||
// ID of the image.
|
||||
ID string
|
||||
// Other names by which this image is known.
|
||||
Tags []string
|
||||
RepoTags []string
|
||||
// The size of the image in bytes.
|
||||
Size int64
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ func toRuntimeImage(image *docker.APIImages) (*kubecontainer.Image, error) {
|
||||
}
|
||||
|
||||
return &kubecontainer.Image{
|
||||
ID: image.ID,
|
||||
Tags: image.RepoTags,
|
||||
Size: image.VirtualSize,
|
||||
ID: image.ID,
|
||||
RepoTags: image.RepoTags,
|
||||
Size: image.VirtualSize,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -75,9 +75,9 @@ func TestToRuntimeImage(t *testing.T) {
|
||||
VirtualSize: 1234,
|
||||
}
|
||||
expected := &kubecontainer.Image{
|
||||
ID: "aeeea",
|
||||
Tags: []string{"abc", "def"},
|
||||
Size: 1234,
|
||||
ID: "aeeea",
|
||||
RepoTags: []string{"abc", "def"},
|
||||
Size: 1234,
|
||||
}
|
||||
|
||||
actual, err := toRuntimeImage(original)
|
||||
|
@ -27,6 +27,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/client/record"
|
||||
"k8s.io/kubernetes/pkg/kubelet/cadvisor"
|
||||
"k8s.io/kubernetes/pkg/kubelet/container"
|
||||
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
"k8s.io/kubernetes/pkg/util/sets"
|
||||
)
|
||||
@ -42,6 +43,8 @@ type imageManager interface {
|
||||
// Start async garbage collection of images.
|
||||
Start() error
|
||||
|
||||
GetImageList() ([]kubecontainer.Image, error)
|
||||
|
||||
// TODO(vmarmol): Have this subsume pulls as well.
|
||||
}
|
||||
|
||||
@ -135,6 +138,15 @@ func (im *realImageManager) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get a list of images on this node
|
||||
func (im *realImageManager) GetImageList() ([]kubecontainer.Image, error) {
|
||||
images, err := im.runtime.ListImages()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return images, nil
|
||||
}
|
||||
|
||||
func (im *realImageManager) detectImages(detected time.Time) error {
|
||||
images, err := im.runtime.ListImages()
|
||||
if err != nil {
|
||||
@ -298,7 +310,7 @@ func isImageUsed(image container.Image, imagesInUse sets.String) bool {
|
||||
if _, ok := imagesInUse[image.ID]; ok {
|
||||
return true
|
||||
}
|
||||
for _, tag := range image.Tags {
|
||||
for _, tag := range image.RepoTags {
|
||||
if _, ok := imagesInUse[tag]; ok {
|
||||
return true
|
||||
}
|
||||
|
@ -312,9 +312,9 @@ func TestFreeSpaceImagesAlsoDoesLookupByRepoTags(t *testing.T) {
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
makeImage(0, 1024),
|
||||
{
|
||||
ID: "5678",
|
||||
Tags: []string{"potato", "salad"},
|
||||
Size: 2048,
|
||||
ID: "5678",
|
||||
RepoTags: []string{"potato", "salad"},
|
||||
Size: 2048,
|
||||
},
|
||||
}
|
||||
fakeRuntime.AllPodList = []*container.Pod{
|
||||
|
@ -2810,11 +2810,30 @@ func (kl *Kubelet) setNodeStatusDaemonEndpoints(node *api.Node) {
|
||||
node.Status.DaemonEndpoints = *kl.daemonEndpoints
|
||||
}
|
||||
|
||||
// Set images list fot this node
|
||||
func (kl *Kubelet) setNodeStatusImages(node *api.Node) {
|
||||
// Update image list of this node
|
||||
var imagesOnNode []api.ContainerImage
|
||||
containerImages, err := kl.imageManager.GetImageList()
|
||||
if err != nil {
|
||||
glog.Errorf("Error getting image list: %v", err)
|
||||
} else {
|
||||
for _, image := range containerImages {
|
||||
imagesOnNode = append(imagesOnNode, api.ContainerImage{
|
||||
RepoTags: image.RepoTags,
|
||||
Size: image.Size,
|
||||
})
|
||||
}
|
||||
}
|
||||
node.Status.Images = imagesOnNode
|
||||
}
|
||||
|
||||
// Set status for the node.
|
||||
func (kl *Kubelet) setNodeStatusInfo(node *api.Node) {
|
||||
kl.setNodeStatusMachineInfo(node)
|
||||
kl.setNodeStatusVersionInfo(node)
|
||||
kl.setNodeStatusDaemonEndpoints(node)
|
||||
kl.setNodeStatusImages(node)
|
||||
}
|
||||
|
||||
// Set Readycondition for the node.
|
||||
|
@ -91,6 +91,18 @@ type TestKubelet struct {
|
||||
func newTestKubelet(t *testing.T) *TestKubelet {
|
||||
fakeRuntime := &kubecontainer.FakeRuntime{}
|
||||
fakeRuntime.VersionInfo = "1.15"
|
||||
fakeRuntime.ImageList = []kubecontainer.Image{
|
||||
{
|
||||
ID: "abc",
|
||||
RepoTags: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"},
|
||||
Size: 123,
|
||||
},
|
||||
{
|
||||
ID: "efg",
|
||||
RepoTags: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"},
|
||||
Size: 456,
|
||||
},
|
||||
}
|
||||
fakeRecorder := &record.FakeRecorder{}
|
||||
fakeKubeClient := &testclient.Fake{}
|
||||
kubelet := &Kubelet{}
|
||||
@ -144,6 +156,17 @@ func newTestKubelet(t *testing.T) *TestKubelet {
|
||||
|
||||
kubelet.volumeManager = newVolumeManager()
|
||||
kubelet.containerManager = cm.NewStubContainerManager()
|
||||
fakeNodeRef := &api.ObjectReference{
|
||||
Kind: "Node",
|
||||
Name: testKubeletHostname,
|
||||
UID: types.UID(testKubeletHostname),
|
||||
Namespace: "",
|
||||
}
|
||||
fakeImageGCPolicy := ImageGCPolicy{
|
||||
HighThresholdPercent: 90,
|
||||
LowThresholdPercent: 80,
|
||||
}
|
||||
kubelet.imageManager, err = newImageManager(fakeRuntime, mockCadvisor, fakeRecorder, fakeNodeRef, fakeImageGCPolicy)
|
||||
fakeClock := &util.FakeClock{Time: time.Now()}
|
||||
kubelet.backOff = util.NewBackOff(time.Second, time.Minute)
|
||||
kubelet.backOff.Clock = fakeClock
|
||||
@ -2556,6 +2579,16 @@ func TestUpdateNewNodeStatus(t *testing.T) {
|
||||
{Type: api.NodeLegacyHostIP, Address: "127.0.0.1"},
|
||||
{Type: api.NodeInternalIP, Address: "127.0.0.1"},
|
||||
},
|
||||
Images: []api.ContainerImage{
|
||||
{
|
||||
RepoTags: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"},
|
||||
Size: 123,
|
||||
},
|
||||
{
|
||||
RepoTags: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"},
|
||||
Size: 456,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -2744,6 +2777,16 @@ func testDockerRuntimeVersion(t *testing.T) {
|
||||
{Type: api.NodeLegacyHostIP, Address: "127.0.0.1"},
|
||||
{Type: api.NodeInternalIP, Address: "127.0.0.1"},
|
||||
},
|
||||
Images: []api.ContainerImage{
|
||||
{
|
||||
RepoTags: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"},
|
||||
Size: 123,
|
||||
},
|
||||
{
|
||||
RepoTags: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"},
|
||||
Size: 456,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -2904,6 +2947,16 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
|
||||
{Type: api.NodeLegacyHostIP, Address: "127.0.0.1"},
|
||||
{Type: api.NodeInternalIP, Address: "127.0.0.1"},
|
||||
},
|
||||
Images: []api.ContainerImage{
|
||||
{
|
||||
RepoTags: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"},
|
||||
Size: 123,
|
||||
},
|
||||
{
|
||||
RepoTags: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"},
|
||||
Size: 456,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -3172,6 +3225,16 @@ func TestUpdateNodeStatusWithoutContainerRuntime(t *testing.T) {
|
||||
{Type: api.NodeLegacyHostIP, Address: "127.0.0.1"},
|
||||
{Type: api.NodeInternalIP, Address: "127.0.0.1"},
|
||||
},
|
||||
Images: []api.ContainerImage{
|
||||
{
|
||||
RepoTags: []string{"gcr.io/google_containers:v1", "gcr.io/google_containers:v2"},
|
||||
Size: 123,
|
||||
},
|
||||
{
|
||||
RepoTags: []string{"gcr.io/google_containers:v3", "gcr.io/google_containers:v4"},
|
||||
Size: 456,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
kubelet.runtimeState = newRuntimeState(time.Duration(0), false, "" /* Pod CIDR */, func() error { return nil })
|
||||
|
@ -86,8 +86,8 @@ func (r *Runtime) ListImages() ([]kubecontainer.Image, error) {
|
||||
images := make([]kubecontainer.Image, len(listResp.Images))
|
||||
for i, image := range listResp.Images {
|
||||
images[i] = kubecontainer.Image{
|
||||
ID: image.Id,
|
||||
Tags: []string{buildImageName(image)},
|
||||
ID: image.Id,
|
||||
RepoTags: []string{buildImageName(image)},
|
||||
//TODO: fill in the size of the image
|
||||
}
|
||||
}
|
||||
|
@ -283,8 +283,8 @@ func TestListImages(t *testing.T) {
|
||||
},
|
||||
[]kubecontainer.Image{
|
||||
{
|
||||
ID: "sha512-a2fb8f390702",
|
||||
Tags: []string{"quay.io/coreos/alpine-sh:latest"},
|
||||
ID: "sha512-a2fb8f390702",
|
||||
RepoTags: []string{"quay.io/coreos/alpine-sh:latest"},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -303,12 +303,12 @@ func TestListImages(t *testing.T) {
|
||||
},
|
||||
[]kubecontainer.Image{
|
||||
{
|
||||
ID: "sha512-a2fb8f390702",
|
||||
Tags: []string{"quay.io/coreos/alpine-sh:latest"},
|
||||
ID: "sha512-a2fb8f390702",
|
||||
RepoTags: []string{"quay.io/coreos/alpine-sh:latest"},
|
||||
},
|
||||
{
|
||||
ID: "sha512-c6b597f42816",
|
||||
Tags: []string{"coreos.com/rkt/stage1-coreos:0.10.0"},
|
||||
ID: "sha512-c6b597f42816",
|
||||
RepoTags: []string{"coreos.com/rkt/stage1-coreos:0.10.0"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user