mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Merge pull request #78592 from tedyu/plugin-mgr
Use read lock for reconciler#getHandlers and clean up for the pluginmanager
This commit is contained in:
commit
e0ae55059d
@ -100,9 +100,7 @@ func (asw *actualStateOfWorld) RemovePlugin(socketPath string) {
|
|||||||
asw.Lock()
|
asw.Lock()
|
||||||
defer asw.Unlock()
|
defer asw.Unlock()
|
||||||
|
|
||||||
if _, ok := asw.socketFileToInfo[socketPath]; ok {
|
delete(asw.socketFileToInfo, socketPath)
|
||||||
delete(asw.socketFileToInfo, socketPath)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (asw *actualStateOfWorld) GetRegisteredPlugins() []PluginInfo {
|
func (asw *actualStateOfWorld) GetRegisteredPlugins() []PluginInfo {
|
||||||
|
@ -147,9 +147,7 @@ func (dsw *desiredStateOfWorld) RemovePlugin(socketPath string) {
|
|||||||
dsw.Lock()
|
dsw.Lock()
|
||||||
defer dsw.Unlock()
|
defer dsw.Unlock()
|
||||||
|
|
||||||
if _, ok := dsw.socketFileToInfo[socketPath]; ok {
|
delete(dsw.socketFileToInfo, socketPath)
|
||||||
delete(dsw.socketFileToInfo, socketPath)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dsw *desiredStateOfWorld) GetPluginsToRegister() []PluginInfo {
|
func (dsw *desiredStateOfWorld) GetPluginsToRegister() []PluginInfo {
|
||||||
|
@ -97,8 +97,8 @@ func (rc *reconciler) AddHandler(pluginType string, pluginHandler cache.PluginHa
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (rc *reconciler) getHandlers() map[string]cache.PluginHandler {
|
func (rc *reconciler) getHandlers() map[string]cache.PluginHandler {
|
||||||
rc.Lock()
|
rc.RLock()
|
||||||
defer rc.Unlock()
|
defer rc.RUnlock()
|
||||||
|
|
||||||
return rc.handlers
|
return rc.handlers
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user