sandbox: add sandbox controller v2
Signed-off-by: Abel Feng <fshb1988@gmail.com>
This commit is contained in:
@@ -48,6 +48,7 @@ func init() {
|
||||
ID: "cri",
|
||||
Requires: []plugin.Type{
|
||||
plugins.CRIServicePlugin,
|
||||
plugins.PodSandboxPlugin,
|
||||
plugins.SandboxControllerPlugin,
|
||||
plugins.NRIApiPlugin,
|
||||
plugins.EventPlugin,
|
||||
@@ -237,13 +238,21 @@ func getNRIAPI(ic *plugin.InitContext) nriservice.API {
|
||||
}
|
||||
|
||||
func getSandboxControllers(ic *plugin.InitContext) (map[string]sandbox.Controller, error) {
|
||||
sc := make(map[string]sandbox.Controller)
|
||||
sandboxers, err := ic.GetByType(plugins.SandboxControllerPlugin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sc := make(map[string]sandbox.Controller)
|
||||
for name, p := range sandboxers {
|
||||
sc[name] = p.(sandbox.Controller)
|
||||
}
|
||||
|
||||
podSandboxers, err := ic.GetByType(plugins.PodSandboxPlugin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for name, p := range podSandboxers {
|
||||
sc[name] = p.(sandbox.Controller)
|
||||
}
|
||||
return sc, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user