inject remoteRuntime to kubelet dependency

This commit is contained in:
louisgong
2019-12-06 13:17:27 +08:00
parent b469404d97
commit 0dd468039d
8 changed files with 35 additions and 59 deletions

View File

@@ -98,20 +98,23 @@ func NewHollowKubelet(
client *clientset.Clientset,
heartbeatClient *clientset.Clientset,
cadvisorInterface cadvisor.Interface,
remoteRuntime *fakeremote.RemoteRuntime,
containerManager cm.ContainerManager) *HollowKubelet {
d := &kubelet.Dependencies{
KubeClient: client,
HeartbeatClient: heartbeatClient,
CAdvisorInterface: cadvisorInterface,
Cloud: nil,
OSInterface: &containertest.FakeOS{},
ContainerManager: containerManager,
VolumePlugins: volumePlugins(),
TLSOptions: nil,
OOMAdjuster: oom.NewFakeOOMAdjuster(),
Mounter: &mount.FakeMounter{},
Subpather: &subpath.FakeSubpath{},
HostUtil: hostutil.NewFakeHostUtil(nil),
KubeClient: client,
HeartbeatClient: heartbeatClient,
RemoteRuntimeService: remoteRuntime.RuntimeService,
RemoteImageService: remoteRuntime.ImageService,
CAdvisorInterface: cadvisorInterface,
Cloud: nil,
OSInterface: &containertest.FakeOS{},
ContainerManager: containerManager,
VolumePlugins: volumePlugins(),
TLSOptions: nil,
OOMAdjuster: oom.NewFakeOOMAdjuster(),
Mounter: &mount.FakeMounter{},
Subpather: &subpath.FakeSubpath{},
HostUtil: hostutil.NewFakeHostUtil(nil),
}
return &HollowKubelet{
@@ -159,8 +162,6 @@ func GetHollowKubeletConfig(opt *HollowKubletOptions) (*options.KubeletFlags, *k
f.MaxPerPodContainerCount = 2
f.NodeLabels = opt.NodeLabels
f.ContainerRuntimeOptions.ContainerRuntime = kubetypes.RemoteContainerRuntime
f.RemoteRuntimeEndpoint = fakeremote.FakeRemoteRuntimeEndpoint
f.RemoteImageEndpoint = fakeremote.FakeRemoteImageEndpoint
f.RegisterNode = true
f.RegisterSchedulable = true
f.ProviderID = fmt.Sprintf("kubemark://%v", opt.NodeName)