//newEdged creates new edged object and initialises it
func newEdged() (*edged, error) {
conf := getConfig()
backoff := flowcontrol.NewBackOff(backOffPeriod, MaxContainerBackOff)
podManager := podmanager.NewpodManager()
policy := images.ImageGCPolicy{
...
}
// build new object to match interface
recorder := record.NewEventRecorder()
ed := &edged{
...
}
...
ed.livenessManager = proberesults.NewManager()
...
statsProvider := edgeimages.NewStatsProvider()
...
//create and start the docker shim running as a grpc server
if conf.remoteRuntimeEndpoint == dockerShimEndpoint || conf.remoteRuntimeEndpoint == dockerShimEndpointDeprecated {
streamingConfig := &streaming.Config{}
dockerClientConfig := &dockershim.ClientConfig{
dockerEndpoint: conf.dockerAddress,
ImagePullProgressDeadline: time.Duration(conf.imagePullProgressDeadline) * time.Second,
EnableSleep: true,
WithTraceDisabled: true,
}
pluginConfigs := dockershim.NetworkPluginSettings{
...
}
...
ds, err := dockershim.NewdockerService(dockerClientConfig, conf.podSandboxImage, streamingConfig,
&pluginConfigs, cgroupName, cgroupDriver, dockershimRootDir, redirectContainerStream)
if err != nil {
return nil, err
}
klog.Infof("RemoteRuntimeEndpoint: %q, remoteImageEndpoint: %q",
conf.remoteRuntimeEndpoint, conf.remoteRuntimeEndpoint)
klog.Info("Starting the GRPC server for the docker CRI shim.")
server := dockerremote.NewdockerServer(conf.remoteRuntimeEndpoint, ds)
if err := server.Start(); err != nil {
return nil, err
}
}
ed.clusterDNS = convertStrToIP(conf.clusterDNS)
ed.dnsConfigurer = kubedns.NewConfigurer(recorder, nodeRef, ed.nodeIP, ed.clusterDNS, conf.clusterDomain, ResolvConfDefault)
containerRefManager := kubecontainer.NewRefManager()
httpClient := &http.Client{}
runtimeService, imageService, err := getRuntimeAndImageServices(conf.remoteRuntimeEndpoint, conf.remoteRuntimeEndpoint, conf.RuntimeRequestTimeout)
if err != nil {
return nil, err
}
if ed.os == nil {
ed.os = kubecontainer.RealOS{}
}
ed.clcm, err = clcm.NewContainerLifecycleManager(DefaultRootDir)
var machineInfo cadvisorapi.MachineInfo
machineInfo.MemoryCapacity = uint64(conf.memoryCapacity)
containerRuntime, err := kuberuntime.NewKubeGenericRuntimeManager(
...
)
cadvisorInterface, err := cadvisor.New("")
containerManager, err := cm.NewContainerManager(mount.New(""),
cadvisorInterface,
cm.NodeConfig{
...
},
false,
conf.devicePluginEnabled,
recorder)
ed.containerRuntime = containerRuntime
ed.containerRuntimeName = RemoteContainerRuntime
ed.containerManager = containerManager
ed.runtimeService = runtimeService
imageGCManager, err := images.NewImageGCManager(ed.containerRuntime, statsProvider, recorder, nodeRef, policy, conf.podSandboxImage)
...
ed.imageGCManager = imageGCManager
containerGCManager, err := kubecontainer.NewContainerGC(containerRuntime, containerGCPolicy, &containers.KubeSourcesReady{})
...
ed.containerGCManager = containerGCManager
ed.server = server.NewServer(ed.podManager)
ed.volumePluginMgr, err = NewInitializedVolumePluginMgr(ed, ProbeVolumePlugins(""))
...
return ed, nil
}