mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #64713 from vikaschoudhary16/start_watcher_bit_later
Automatic merge from submit-queue (batch tested with PRs 64713, 65193, 65194). 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>. Start plugin watcher after initialization of all kubelet components **What this PR does / why we need it**: Currently watcher server is started before initialization of runtime dependent modules. Watcher should be started after the initialization of all the modules. If a module wants to use watcher, it must add a callback handler to the watcher. If a module adds watcher handler after the watcher has already got started, some of the notifications may get missed. There watcher server should be started after the initialization of all the modules. **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 # **Special notes for your reviewer**: **Release note**: ```release-note None ``` /sig node /cc @jiayingz @RenaudWasTaken @vishh @ScorpioCPH @sjenning @derekwaynecarr @jeremyeder @saad-ali @chakri-nelluri @ConnorDoyle @dchen1107 @sbezverk @vladimirvivien
This commit is contained in:
commit
7e773b8fdd
@ -786,7 +786,9 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
klet.pluginWatcher = pluginwatcher.NewWatcher(klet.getPluginsDir())
|
||||
if klet.enablePluginsWatcher {
|
||||
klet.pluginWatcher = pluginwatcher.NewWatcher(klet.getPluginsDir())
|
||||
}
|
||||
|
||||
// If the experimentalMounterPathFlag is set, we do not want to
|
||||
// check node capabilities since the mount path is not the default
|
||||
@ -1290,15 +1292,6 @@ func (kl *Kubelet) initializeModules() error {
|
||||
glog.Errorf("Failed to create directory %q: %v", ContainerLogsDir, err)
|
||||
}
|
||||
}
|
||||
if kl.enablePluginsWatcher {
|
||||
// Adding Registration Callback function for CSI Driver
|
||||
kl.pluginWatcher.AddHandler("CSIPlugin", csi.RegistrationCallback)
|
||||
|
||||
// Start the plugin watcher
|
||||
if err := kl.pluginWatcher.Start(); err != nil {
|
||||
return fmt.Errorf("failed to start Plugin Watcher. err: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Start the image manager.
|
||||
kl.imageManager.Start()
|
||||
@ -1347,6 +1340,16 @@ func (kl *Kubelet) initializeRuntimeDependentModules() {
|
||||
// container log manager must start after container runtime is up to retrieve information from container runtime
|
||||
// and inform container to reopen log file after log rotation.
|
||||
kl.containerLogManager.Start()
|
||||
if kl.enablePluginsWatcher {
|
||||
// Adding Registration Callback function for CSI Driver
|
||||
kl.pluginWatcher.AddHandler("CSIPlugin", csi.RegistrationCallback)
|
||||
// Start the plugin watcher
|
||||
glog.V(4).Infof("starting watcher")
|
||||
if err := kl.pluginWatcher.Start(); err != nil {
|
||||
kl.recorder.Eventf(kl.nodeRef, v1.EventTypeWarning, events.KubeletSetupFailed, err.Error())
|
||||
glog.Fatalf("failed to start Plugin Watcher. err: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run starts the kubelet reacting to config updates
|
||||
|
Loading…
Reference in New Issue
Block a user