kubelet: Fixes plugin Watcher for Windows
Currently, the plugin Watcher checks if a file is a socket or not by running mode&os.ModeSocket != 0, which can't be True on Windows. util.IsUnixDomainSocket should be used instead.
This commit is contained in:
parent
bc974c8ab9
commit
f567b85cc4
@ -131,12 +131,12 @@ func (w *Watcher) traversePluginDir(dir string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
switch mode := info.Mode(); {
|
mode := info.Mode()
|
||||||
case mode.IsDir():
|
if mode.IsDir() {
|
||||||
if err := w.fsWatcher.Add(path); err != nil {
|
if err := w.fsWatcher.Add(path); err != nil {
|
||||||
return fmt.Errorf("failed to watch %s, err: %v", path, err)
|
return fmt.Errorf("failed to watch %s, err: %v", path, err)
|
||||||
}
|
}
|
||||||
case mode&os.ModeSocket != 0:
|
} else if isSocket, _ := util.IsUnixDomainSocket(path); isSocket {
|
||||||
event := fsnotify.Event{
|
event := fsnotify.Event{
|
||||||
Name: path,
|
Name: path,
|
||||||
Op: fsnotify.Create,
|
Op: fsnotify.Create,
|
||||||
@ -145,7 +145,7 @@ func (w *Watcher) traversePluginDir(dir string) error {
|
|||||||
if err := w.handleCreateEvent(event); err != nil {
|
if err := w.handleCreateEvent(event); err != nil {
|
||||||
klog.ErrorS(err, "Error when handling create", "event", event)
|
klog.ErrorS(err, "Error when handling create", "event", event)
|
||||||
}
|
}
|
||||||
default:
|
} else {
|
||||||
klog.V(5).InfoS("Ignoring file", "path", path, "mode", mode)
|
klog.V(5).InfoS("Ignoring file", "path", path, "mode", mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user