Backport #7685 to sbserver

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko 2023-01-17 14:24:06 -08:00
parent b0d7a96976
commit 41eabf134a

View File

@ -330,6 +330,8 @@ func (c *criService) setupPodNetwork(ctx context.Context, sandbox *sandboxstore.
config = sandbox.Config config = sandbox.Config
path = sandbox.NetNSPath path = sandbox.NetNSPath
netPlugin = c.getNetworkPlugin(sandbox.RuntimeHandler) netPlugin = c.getNetworkPlugin(sandbox.RuntimeHandler)
err error
result *cni.Result
) )
if netPlugin == nil { if netPlugin == nil {
return errors.New("cni config not initialized") return errors.New("cni config not initialized")
@ -341,7 +343,11 @@ func (c *criService) setupPodNetwork(ctx context.Context, sandbox *sandboxstore.
} }
log.G(ctx).WithField("podsandboxid", id).Debugf("begin cni setup") log.G(ctx).WithField("podsandboxid", id).Debugf("begin cni setup")
netStart := time.Now() netStart := time.Now()
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...)
}
networkPluginOperations.WithValues(networkSetUpOp).Inc() networkPluginOperations.WithValues(networkSetUpOp).Inc()
networkPluginOperationsLatency.WithValues(networkSetUpOp).UpdateSince(netStart) networkPluginOperationsLatency.WithValues(networkSetUpOp).UpdateSince(netStart)
if err != nil { if err != nil {