Add delegate API in multus-daemon (#890)

This changes introduce delegate API function in multus-daemon.
This API will be consumed from other programs for hot-plug
interface into running pod. This change also cleanups server
code to split into client code and server code to easy to import
from other golang code.
This commit is contained in:
Tomofumi Hayashi
2022-08-10 00:45:23 +09:00
committed by GitHub
parent 8dee74d7b9
commit 505ab4567c
17 changed files with 409 additions and 183 deletions

View File

@@ -32,6 +32,7 @@ import (
"gopkg.in/k8snetworkplumbingwg/multus-cni.v3/pkg/logging"
"gopkg.in/k8snetworkplumbingwg/multus-cni.v3/pkg/multus"
srv "gopkg.in/k8snetworkplumbingwg/multus-cni.v3/pkg/server"
"gopkg.in/k8snetworkplumbingwg/multus-cni.v3/pkg/server/api"
"gopkg.in/k8snetworkplumbingwg/multus-cni.v3/pkg/server/config"
"gopkg.in/k8snetworkplumbingwg/multus-cni.v3/pkg/types"
@@ -251,9 +252,9 @@ func startMultusDaemon(configFilePath string) error {
}, 0)
}
l, err := srv.GetListener(srv.SocketPath(daemonConfig.MultusSocketDir))
l, err := srv.GetListener(api.SocketPath(daemonConfig.MultusSocketDir))
if err != nil {
return fmt.Errorf("failed to start the CNI server using socket %s. Reason: %+v", srv.SocketPath(daemonConfig.MultusSocketDir), err)
return fmt.Errorf("failed to start the CNI server using socket %s. Reason: %+v", api.SocketPath(daemonConfig.MultusSocketDir), err)
}
server.SetKeepAlivesEnabled(false)