mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 15:05:20 +00:00
Expose image list in node status
Change image manager to use repotag
This commit is contained in:
@@ -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
|
||||
@@ -2557,6 +2580,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,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2745,6 +2778,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,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2905,6 +2948,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,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -3173,6 +3226,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 })
|
||||
|
||||
Reference in New Issue
Block a user