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>
(cherry picked from commit b16d467)
There was no merge conflict, but the commit was amended to cover
sbserver.
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
  • Loading branch information
zzzzzzzzzy9 authored and AkihiroSuda committed Apr 23, 2024
1 parent e412ca7 commit 293f515
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/cri/sbserver/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
3 changes: 2 additions & 1 deletion pkg/cri/server/sandbox_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,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 293f515

Please sign in to comment.