From 0b6a0fe7731ef192f892054a9f1875ddbf2aa07c Mon Sep 17 00:00:00 2001 From: Rodrigo Campos Date: Mon, 10 Jul 2023 12:56:59 +0200 Subject: [PATCH] cri/sbserver: Move runtimeStart to match position with cri/server Commit c085fac1e5 ("Move sandbox start behind controller") moved the runtimeStart to only account for time _after_ the netns has been created. To match what we currently do in cri/server, let's move it to just after the get the sandbox runtime. This come up when porting userns to sbserver, as the CNI network setup needs to be done at a later stage and runtimeStart was accounting for the CNI network setup time only when userns is enabled. To avoid that discrepancy, let's just move it earlier, that also matches what we do in cri/server. Signed-off-by: Rodrigo Campos --- pkg/cri/sbserver/sandbox_run.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/cri/sbserver/sandbox_run.go b/pkg/cri/sbserver/sandbox_run.go index d09b38dcd..713a785be 100644 --- a/pkg/cri/sbserver/sandbox_run.go +++ b/pkg/cri/sbserver/sandbox_run.go @@ -94,6 +94,7 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox sandboxInfo.Runtime.Name = ociRuntime.Type + runtimeStart := time.Now() // Retrieve runtime options runtimeOpts, err := generateRuntimeOptions(ociRuntime) if err != nil { @@ -222,8 +223,6 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox return nil, fmt.Errorf("unable to update extensions for sandbox %q: %w", id, err) } - runtimeStart := time.Now() - if err := controller.Create(ctx, id, sb.WithOptions(config), sb.WithNetNSPath(sandbox.NetNSPath)); err != nil { return nil, fmt.Errorf("failed to create sandbox %q: %w", id, err) }