Skip to content

Instantly share code, notes, and snippets.

@ddebroy
Created August 9, 2019 00:09
Show Gist options
  • Select an option

  • Save ddebroy/94212336b38c67f59a5d207609f3659d to your computer and use it in GitHub Desktop.

Select an option

Save ddebroy/94212336b38c67f59a5d207609f3659d to your computer and use it in GitHub Desktop.

Revisions

  1. ddebroy created this gist Aug 9, 2019.
    45 changes: 45 additions & 0 deletions windows.pluginwatcher.kk.patch
    Original 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