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 <zhang.yu58@zte.com.cn>
This commit is contained in:
张钰10307750 2024-01-23 10:32:20 +08:00 committed by zzzzzzzzzy9
parent be9336fed1
commit b16d467404

View File

@ -121,6 +121,7 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
},
sandboxstore.Status{
State: sandboxstore.StateUnknown,
CreatedAt: time.Now().UTC(),
},
)