Unverified Commit 47545753 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #59276 from roboll/roboll/kubelet-fix

Automatic merge from submit-queue (batch tested with PRs 59276, 51042, 58973, 59377, 59472). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. kubelet: only register api source when connecting **What this PR does / why we need it**: 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. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #59275 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents f821a54d 7da7b750
...@@ -279,9 +279,11 @@ func makePodSourceConfig(kubeCfg *kubeletconfiginternal.KubeletConfiguration, ku ...@@ -279,9 +279,11 @@ func makePodSourceConfig(kubeCfg *kubeletconfiginternal.KubeletConfiguration, ku
// Restore from the checkpoint path // Restore from the checkpoint path
// NOTE: This MUST happen before creating the apiserver source // NOTE: This MUST happen before creating the apiserver source
// below, or the checkpoint would override the source of truth. // below, or the checkpoint would override the source of truth.
updatechannel := cfg.Channel(kubetypes.ApiserverSource)
var updatechannel chan<- interface{}
if bootstrapCheckpointPath != "" { if bootstrapCheckpointPath != "" {
glog.Infof("Adding checkpoint path: %v", bootstrapCheckpointPath) glog.Infof("Adding checkpoint path: %v", bootstrapCheckpointPath)
updatechannel = cfg.Channel(kubetypes.ApiserverSource)
err := cfg.Restore(bootstrapCheckpointPath, updatechannel) err := cfg.Restore(bootstrapCheckpointPath, updatechannel)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -290,6 +292,9 @@ func makePodSourceConfig(kubeCfg *kubeletconfiginternal.KubeletConfiguration, ku ...@@ -290,6 +292,9 @@ func makePodSourceConfig(kubeCfg *kubeletconfiginternal.KubeletConfiguration, ku
if kubeDeps.KubeClient != nil { if kubeDeps.KubeClient != nil {
glog.Infof("Watching apiserver") glog.Infof("Watching apiserver")
if updatechannel == nil {
updatechannel = cfg.Channel(kubetypes.ApiserverSource)
}
config.NewSourceApiserver(kubeDeps.KubeClient, nodeName, updatechannel) config.NewSourceApiserver(kubeDeps.KubeClient, nodeName, updatechannel)
} }
return cfg, nil return cfg, nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment