-
Notifications
You must be signed in to change notification settings - Fork 40.6k
Add kubelet plugin manager #73891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add kubelet plugin manager #73891
Conversation
@saad-ali I was looking at nestedpendingoperations but wasn't sure how to use it to register/unregister plugin. Could you please point me to a similar example? |
c472ca1
to
ec659e5
Compare
@taragu there is a generic version of the The Once you have an Then you can create the dumb diff loop, the Once you have that, you need to write a |
@saad-ali thank you so much!! This is very comprehensive. I'll try to digest this later this evening. |
ec659e5
to
5f07de8
Compare
17aa31b
to
a6f39d6
Compare
1853dcf
to
dc863d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: saad-ali, taragu, vishh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
/milestone v1.15 |
…ion/unregistration
/lgtm |
/hold cancel |
/test pull-kubernetes-integration |
1 similar comment
/test pull-kubernetes-integration |
asw.Lock() | ||
defer asw.Unlock() | ||
|
||
if _, ok := asw.socketFileToInfo[socketPath]; ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why the check is needed - we can delete the entry directly.
It is fine if the key doesn't exist.
dsw.Lock() | ||
defer dsw.Unlock() | ||
|
||
if _, ok := dsw.socketFileToInfo[socketPath]; ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to check prior to deletion
return nil | ||
} | ||
|
||
// Dial establishes the gRPC communication with the picked up plugin socket. https://godoc.org/google.golang.org/grpc#Dial |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be lowercase: dial
} | ||
|
||
func (rc *reconciler) getHandlers() map[string]cache.PluginHandler { | ||
rc.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting read lock should suffice
actualStateOfWorldUpdater ActualStateOfWorldUpdater) func() error { | ||
|
||
unregisterPluginFunc := func() error { | ||
client, conn, err := dial(socketPath, dialTimeoutDuration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the plugin has already exited, the dial here will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The client is needed to retrieve from pluginHandlers using infoResp.Type
Do you have suggestion on how to get plugin handler in that case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The client is needed to retrieve from pluginHandlers using infoResp.Type
Do you have suggestion on how to get plugin handler in that case ?
The csi plugin will delete the sock file when it exits. When the operationExecutor.UnregisterPlugin is called, the sock file is not existed.
Can add a sock file to the plugin mapping table. ≧◠◡◠≦ Just like 1.14:
func (w *Watcher) getPlugin(socketPath string) (pathInfo, bool) {
w.mutex.Lock()
defer w.mutex.Unlock()
plugin, ok := w.plugins[socketPath]
return plugin, ok
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my POV, we can save socketPath: infoResp.Type in actualStateOfWorld on RegisterPlugin phase, and then it can be used on UnregisterPlugin phase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made similar suggestion over #87282
Let's see what other people think.
What type of PR is this?
/kind feature
What this PR does / why we need it:
Implement a controller that manages plugin registration/unregistration
Which issue(s) this PR fixes:
Fixes #73371
Special notes for your reviewer:
Does this PR introduce a user-facing change?: