Skip to content

Commit 293f515

Browse files
zzzzzzzzzy9AkihiroSuda
authored andcommitted
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 <[email protected]> (cherry picked from commit b16d467) There was no merge conflict, but the commit was amended to cover sbserver. Signed-off-by: Akihiro Suda <[email protected]>
1 parent e412ca7 commit 293f515

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

pkg/cri/sbserver/sandbox_run.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
120120
RuntimeHandler: r.GetRuntimeHandler(),
121121
},
122122
sandboxstore.Status{
123-
State: sandboxstore.StateUnknown,
123+
State: sandboxstore.StateUnknown,
124+
CreatedAt: time.Now().UTC(),
124125
},
125126
)
126127

pkg/cri/server/sandbox_run.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
9696
RuntimeHandler: r.GetRuntimeHandler(),
9797
},
9898
sandboxstore.Status{
99-
State: sandboxstore.StateUnknown,
99+
State: sandboxstore.StateUnknown,
100+
CreatedAt: time.Now().UTC(),
100101
},
101102
)
102103

0 commit comments

Comments
 (0)