Merge pull request #82594 from yutedz/oper-gen-plugin-err

Check the error return from AddPlugin
This commit is contained in:
Kubernetes Prow Robot 2019-09-19 14:20:58 -07:00 committed by GitHub
commit 3d897f21fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -15,6 +15,7 @@ go_library(
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
"//vendor/github.com/pkg/errors:go_default_library",
"//vendor/google.golang.org/grpc:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
)

View File

@ -23,6 +23,7 @@ package operationexecutor
import (
"context"
"fmt"
"k8s.io/klog"
"net"
"time"
@ -112,11 +113,14 @@ func (og *operationGenerator) GenerateRegisterPluginFunc(
}
// We add the plugin to the actual state of world cache before calling a plugin consumer's Register handle
// so that if we receive a delete event during Register Plugin, we can process it as a DeRegister call.
actualStateOfWorldUpdater.AddPlugin(cache.PluginInfo{
err = actualStateOfWorldUpdater.AddPlugin(cache.PluginInfo{
SocketPath: socketPath,
FoundInDeprecatedDir: foundInDeprecatedDir,
Timestamp: timestamp,
})
if err != nil {
klog.Errorf("RegisterPlugin error -- failed to add plugin at socket %s, err: %v", socketPath, err)
}
if err := handler.RegisterPlugin(infoResp.Name, infoResp.Endpoint, infoResp.SupportedVersions); err != nil {
return og.notifyPlugin(client, false, fmt.Sprintf("RegisterPlugin error -- plugin registration failed with err: %v", err))
}