Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions server/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ func (s *Server) CreateContainer(ctx context.Context, req *types.CreateContainer
return nil, fmt.Errorf("failed to get ID of container with reserved name (%s), after failing to reserve name with %v: %w", ctr.Name(), getErr, getErr)
}
// if we're able to find the container, and it's created, this is actually a duplicate request
// from a client that does not behave like the kubelet (like crictl)
// Just return that container
if reservedCtr := s.GetContainer(reservedID); reservedCtr != nil && reservedCtr.Created() {
return nil, err
return &types.CreateContainerResponse{ContainerId: reservedID}, nil
}
cachedID, resourceErr := s.getResourceOrWait(ctx, ctr.Name(), "container")
if resourceErr == nil {
Expand Down
4 changes: 2 additions & 2 deletions server/sandbox_run_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,9 @@ func (s *Server) runPodSandbox(ctx context.Context, req *types.RunPodSandboxRequ
return nil, fmt.Errorf("failed to get ID of pod with reserved name (%s), after failing to reserve name with %v: %w", sbox.Name(), getErr, getErr)
}
// if we're able to find the sandbox, and it's created, this is actually a duplicate request
// from a client that does not behave like the kubelet (like crictl)
// Just return that sandbox
if reservedSbox := s.GetSandbox(reservedID); reservedSbox != nil && reservedSbox.Created() {
return nil, err
return &types.RunPodSandboxResponse{PodSandboxId: reservedID}, nil
}
cachedID, resourceErr := s.getResourceOrWait(ctx, sbox.Name(), "sandbox")
if resourceErr == nil {
Expand Down
5 changes: 3 additions & 2 deletions test/timeout.bats
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ function wait_clean() {

@test "should not wait for actual duplicate pod request" {
start_crio
crictl runp "$TESTDATA"/sandbox_config.json
pod_1=$(crictl runp "$TESTDATA"/sandbox_config.json)
SECONDS=0
! crictl runp "$TESTDATA"/sandbox_config.json
pod_2=$(crictl runp "$TESTDATA"/sandbox_config.json)
[[ "$SECONDS" -lt 240 ]]
[[ "$pod_1" == "$pod_2" ]]
}

@test "should clean up container after timeout if not re-requested" {
Expand Down