From 7da7b750fdfb6f2a12f64e5de81eb35465359bbb Mon Sep 17 00:00:00 2001 From: rob boll Date: Thu, 1 Feb 2018 15:09:09 -0500 Subject: [PATCH] kubelet: only register api source when connecting before this change, an api source was always registered, even when there was no kubeclient. this lead to some operations blocking waiting for podConfig.SeenAllSources to pass, which it never would. --- pkg/kubelet/kubelet.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index bdb3a71dab3..bdbb3e54fc1 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -278,9 +278,11 @@ func makePodSourceConfig(kubeCfg *kubeletconfiginternal.KubeletConfiguration, ku // Restore from the checkpoint path // NOTE: This MUST happen before creating the apiserver source // below, or the checkpoint would override the source of truth. - updatechannel := cfg.Channel(kubetypes.ApiserverSource) + + var updatechannel chan<- interface{} if bootstrapCheckpointPath != "" { glog.Infof("Adding checkpoint path: %v", bootstrapCheckpointPath) + updatechannel = cfg.Channel(kubetypes.ApiserverSource) err := cfg.Restore(bootstrapCheckpointPath, updatechannel) if err != nil { return nil, err @@ -289,6 +291,9 @@ func makePodSourceConfig(kubeCfg *kubeletconfiginternal.KubeletConfiguration, ku if kubeDeps.KubeClient != nil { glog.Infof("Watching apiserver") + if updatechannel == nil { + updatechannel = cfg.Channel(kubetypes.ApiserverSource) + } config.NewSourceApiserver(kubeDeps.KubeClient, nodeName, updatechannel) } return cfg, nil