// New creates a new Kubelet for use in main func NewMainKubelet( hn string, dc dockertools.DockerInterface, ec tools.EtcdClient, rd string, ni string, ri time.Duration, pullQPS float32, pullBurst int, minimumGCAge time.Duration, maxContainerCount int) *Kubelet { return &Kubelet{ hostname: hn, dockerClient: dc, etcdClient: ec, rootDirectory: rd, resyncInterval: ri, networkContainerImage: ni, podWorkers: newPodWorkers(), dockerIDToRef: map[dockertools.DockerID]*api.ObjectReference{}, runner: dockertools.NewDockerContainerCommandRunner(dc), httpClient: &http.Client{}, pullQPS: pullQPS, pullBurst: pullBurst, minimumGCAge: minimumGCAge, maxContainerCount: maxContainerCount, } }
// New creates a new Kubelet for use in main func NewMainKubelet( hostname string, dockerClient dockertools.DockerInterface, etcdClient tools.EtcdClient, kubeClient *client.Client, rootDirectory string, networkContainerImage string, resyncInterval time.Duration, pullQPS float32, pullBurst int, minimumGCAge time.Duration, maxContainerCount int, sourceReady SourceReadyFn, clusterDomain string, clusterDNS net.IP, masterServiceNamespace string) (*Kubelet, error) { if rootDirectory == "" { return nil, fmt.Errorf("invalid root directory %q", rootDirectory) } if resyncInterval <= 0 { return nil, fmt.Errorf("invalid sync frequency %d", resyncInterval) } if minimumGCAge <= 0 { return nil, fmt.Errorf("invalid minimum GC age %d", minimumGCAge) } serviceStore := cache.NewStore() cache.NewReflector(&cache.ListWatch{kubeClient, labels.Everything(), "services", api.NamespaceAll}, &api.Service{}, serviceStore).Run() serviceLister := &cache.StoreToServiceLister{serviceStore} klet := &Kubelet{ hostname: hostname, dockerClient: dockerClient, etcdClient: etcdClient, rootDirectory: rootDirectory, resyncInterval: resyncInterval, networkContainerImage: networkContainerImage, podWorkers: newPodWorkers(), dockerIDToRef: map[dockertools.DockerID]*api.ObjectReference{}, runner: dockertools.NewDockerContainerCommandRunner(dockerClient), httpClient: &http.Client{}, pullQPS: pullQPS, pullBurst: pullBurst, minimumGCAge: minimumGCAge, maxContainerCount: maxContainerCount, sourceReady: sourceReady, clusterDomain: clusterDomain, clusterDNS: clusterDNS, serviceLister: serviceLister, masterServiceNamespace: masterServiceNamespace, } if err := klet.setupDataDirs(); err != nil { return nil, err } return klet, nil }
// New creates a new Kubelet for use in main func NewMainKubelet( hn string, dc dockertools.DockerInterface, cc CadvisorInterface, ec tools.EtcdClient, rd string, ri time.Duration) *Kubelet { return &Kubelet{ hostname: hn, dockerClient: dc, cadvisorClient: cc, etcdClient: ec, rootDirectory: rd, resyncInterval: ri, podWorkers: newPodWorkers(), runner: dockertools.NewDockerContainerCommandRunner(), httpClient: &http.Client{}, } }
// New creates a new Kubelet for use in main func NewMainKubelet( hostname string, dockerClient dockertools.DockerInterface, etcdClient tools.EtcdClient, kubeClient *client.Client, rootDirectory string, networkContainerImage string, resyncInterval time.Duration, pullQPS float32, pullBurst int, minimumGCAge time.Duration, maxContainerCount int, sourcesReady SourcesReadyFn, clusterDomain string, clusterDNS net.IP) (*Kubelet, error) { if resyncInterval <= 0 { return nil, fmt.Errorf("invalid sync frequency %d", resyncInterval) } if minimumGCAge <= 0 { return nil, fmt.Errorf("invalid minimum GC age %d", minimumGCAge) } return &Kubelet{ hostname: hostname, dockerClient: dockerClient, etcdClient: etcdClient, rootDirectory: rootDirectory, resyncInterval: resyncInterval, networkContainerImage: networkContainerImage, podWorkers: newPodWorkers(), dockerIDToRef: map[dockertools.DockerID]*api.ObjectReference{}, runner: dockertools.NewDockerContainerCommandRunner(dockerClient), httpClient: &http.Client{}, pullQPS: pullQPS, pullBurst: pullBurst, minimumGCAge: minimumGCAge, maxContainerCount: maxContainerCount, sourcesReady: sourcesReady, clusterDomain: clusterDomain, clusterDNS: clusterDNS, }, nil }