Skip to content

Commit

Permalink
pod: CreatedAt time will be 269 years ago while creating cri network …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
zzzzzzzzzy9 committed Jan 23, 2024
1 parent be9336f commit b16d467
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/cri/server/sandbox_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
)

Expand Down

0 comments on commit b16d467

Please sign in to comment.