Created
August 9, 2019 00:09
-
-
Save ddebroy/94212336b38c67f59a5d207609f3659d to your computer and use it in GitHub Desktop.
Revisions
-
ddebroy created this gist
Aug 9, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ diff --git a/pkg/kubelet/pluginmanager/pluginwatcher/plugin_watcher.go b/pkg/kubelet/pluginmanager/pluginwatcher/pl diff --git a/pkg/kubelet/pluginmanager/pluginwatcher/plugin_watcher.go b/pkg/kubelet/pluginmanager/pluginwatcher/plugin_watcher.go index ace935c..234a358 100644 --- a/pkg/kubelet/pluginmanager/pluginwatcher/plugin_watcher.go +++ b/pkg/kubelet/pluginmanager/pluginwatcher/plugin_watcher.go @@ -20,6 +20,7 @@ import ( "fmt" "os" "path/filepath" + "runtime" "strings" "time" @@ -188,16 +192,18 @@ func (w *Watcher) handleCreateEvent(event fsnotify.Event) error { } if strings.HasPrefix(fi.Name(), ".") { klog.V(5).Infof("Ignoring file (starts with '.'): %s", fi.Name()) return nil } if !fi.IsDir() { + /* if fi.Mode()&os.ModeSocket == 0 { - klog.V(5).Infof("Ignoring non socket file %s", fi.Name()) + klog.V(2).Infof("Ignoring non socket file %s", fi.Name()) return nil } - + */ + klog.V(2).Infof("Invoke w.handlePluginRegistration with file mode: %s", fi.Mode()) return w.handlePluginRegistration(event.Name) } @@ -205,6 +211,10 @@ func (w *Watcher) handleCreateEvent(event fsnotify.Event) error { } func (w *Watcher) handlePluginRegistration(socketPath string) error { + if runtime.GOOS == "windows" { + socketPath = "c:" + socketPath + } + //TODO: Implement rate limiting to mitigate any DOS kind of attacks. // Update desired state of world list of plugins // If the socket path does exist in the desired world cache, there's still