// RunKubelet is responsible for setting up and running a kubelet. It is used in three different applications: // 1 Integration tests // 2 Kubelet binary // 3 Standalone 'kubernetes' binary // Eventually, #2 will be replaced with instances of #3 func RunKubelet(kcfg *KubeletConfig) { kcfg.Hostname = util.GetHostname(kcfg.HostnameOverride) if kcfg.KubeClient != nil { kubelet.SetupEventSending(kcfg.KubeClient, kcfg.Hostname) } else { glog.Infof("No api server defined - no events will be sent.") } kubelet.SetupLogging() kubelet.SetupCapabilities(kcfg.AllowPrivileged) cfg := makePodSourceConfig(kcfg) k, err := createAndInitKubelet(kcfg, cfg) if err != nil { glog.Errorf("Failed to create kubelet: %s", err) return } // process pods and exit. if kcfg.Runonce { if _, err := k.RunOnce(cfg.Updates()); err != nil { glog.Errorf("--runonce failed: %v", err) } } else { startKubelet(k, cfg, kcfg) } }
// RunKubelet is responsible for setting up and running a kubelet. It is used in three different applications: // 1 Integration tests // 2 Kubelet binary // 3 Standalone 'kubernetes' binary // Eventually, #2 will be replaced with instances of #3 func RunKubelet(kcfg *KubeletConfig) { kcfg.Hostname = util.GetHostname(kcfg.HostnameOverride) kcfg.Recorder = record.FromSource(api.EventSource{Component: "kubelet", Host: kcfg.Hostname}) if kcfg.KubeClient != nil { kubelet.SetupEventSending(kcfg.KubeClient, kcfg.Hostname) } else { glog.Infof("No api server defined - no events will be sent.") } kubelet.SetupLogging() kubelet.SetupCapabilities(kcfg.AllowPrivileged) credentialprovider.SetPreferredDockercfgPath(kcfg.RootDirectory) podCfg := makePodSourceConfig(kcfg) k, err := createAndInitKubelet(kcfg, podCfg) if err != nil { glog.Errorf("Failed to create kubelet: %s", err) return } // process pods and exit. if kcfg.Runonce { if _, err := k.RunOnce(podCfg.Updates()); err != nil { glog.Errorf("--runonce failed: %v", err) } } else { startKubelet(k, podCfg, kcfg) } }