can set up the network serially by CNI plugins

Signed-off-by: Fei Su <sofat1989@126.com>
This commit is contained in:
Fei Su
2022-11-08 14:23:59 +08:00
committed by Fei Su
parent 344da9edb2
commit f6232793b4
4 changed files with 20 additions and 9 deletions

View File

@@ -425,6 +425,8 @@ func (c *criService) setupPodNetwork(ctx context.Context, sandbox *sandboxstore.
config = sandbox.Config
path = sandbox.NetNSPath
netPlugin = c.getNetworkPlugin(sandbox.RuntimeHandler)
err error
result *cni.Result
)
if netPlugin == nil {
return errors.New("cni config not initialized")
@@ -435,7 +437,11 @@ func (c *criService) setupPodNetwork(ctx context.Context, sandbox *sandboxstore.
return fmt.Errorf("get cni namespace options: %w", err)
}
log.G(ctx).WithField("podsandboxid", id).Debugf("begin cni setup")
result, err := netPlugin.Setup(ctx, id, path, opts...)
if c.config.CniConfig.NetworkPluginSetupSerially {
result, err = netPlugin.SetupSerially(ctx, id, path, opts...)
} else {
result, err = netPlugin.Setup(ctx, id, path, opts...)
}
if err != nil {
return err
}