Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix dynamic kubelet config init order
If the metrics ain't created, the values will not be registered, and the
metrics will not be visible in the metric endpoint.

Therefore move init of dynamic kubelet config below the startup of the
kubelet server (and the init of metrics).
  • Loading branch information
odinuge committed Sep 28, 2019
1 parent be657f7 commit 2292873
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cmd/kubelet/app/server.go
Expand Up @@ -589,14 +589,6 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
}
}

// If the kubelet config controller is available, and dynamic config is enabled, start the config and status sync loops
if utilfeature.DefaultFeatureGate.Enabled(features.DynamicKubeletConfig) && len(s.DynamicConfigDir.Value()) > 0 &&
kubeDeps.KubeletConfigController != nil && !standaloneMode && !s.RunOnce {
if err := kubeDeps.KubeletConfigController.StartSync(kubeDeps.KubeClient, kubeDeps.EventClient, string(nodeName)); err != nil {
return err
}
}

if kubeDeps.Auth == nil {
auth, err := BuildAuth(nodeName, kubeDeps.KubeClient, s.KubeletConfiguration)
if err != nil {
Expand Down Expand Up @@ -721,6 +713,14 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
return err
}

// If the kubelet config controller is available, and dynamic config is enabled, start the config and status sync loops
if utilfeature.DefaultFeatureGate.Enabled(features.DynamicKubeletConfig) && len(s.DynamicConfigDir.Value()) > 0 &&
kubeDeps.KubeletConfigController != nil && !standaloneMode && !s.RunOnce {
if err := kubeDeps.KubeletConfigController.StartSync(kubeDeps.KubeClient, kubeDeps.EventClient, string(nodeName)); err != nil {
return err
}
}

if s.HealthzPort > 0 {
mux := http.NewServeMux()
healthz.InstallHandler(mux)
Expand Down

0 comments on commit 2292873

Please sign in to comment.