From b16d4674042f30a4a2b407eaf9cad66dd58afad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=92=B010307750?= Date: Tue, 23 Jan 2024 10:32:20 +0800 Subject: [PATCH] pod: CreatedAt time will be 269 years ago while creating cri network failed. We should set sandbox CreatedAt first time when we create sandbox struct, and then set sandbox CreatedAt second time after container started. Before this commit, we just set sandbox CreatedAt after container started, but if network create failed, the sandbox time is the default time, which is 269 years ago, so we need to set sandbox CreatedAt at first, even if an error occurred before start container. Signed-off-by: zzzzzzzzzy9 --- pkg/cri/server/sandbox_run.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/cri/server/sandbox_run.go b/pkg/cri/server/sandbox_run.go index 2501b7cb6..516ab3ac8 100644 --- a/pkg/cri/server/sandbox_run.go +++ b/pkg/cri/server/sandbox_run.go @@ -120,7 +120,8 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox RuntimeHandler: r.GetRuntimeHandler(), }, sandboxstore.Status{ - State: sandboxstore.StateUnknown, + State: sandboxstore.StateUnknown, + CreatedAt: time.Now().UTC(), }, )