Skip to content

Commit

Permalink
Set StopTimeout for service-container started under podman kube play
Browse files Browse the repository at this point in the history
Fixes: #19139

Service containers are defaulting to 0 seconds for Timeout rather then
the settings in containers.conf.

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Aug 24, 2023
1 parent d2ec127 commit f32e954
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pkg/domain/infra/abi/play.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func (ic *ContainerEngine) createServiceContainer(ctx context.Context, name stri
return nil, fmt.Errorf("image for service container: %w", err)
}

rtc, err := ic.Libpod.GetConfigNoCopy()
if err != nil {
return nil, err
}
ctrOpts := entities.ContainerCreateOptions{
// Inherited from infra containers
ImageVolume: define.TypeBind,
Expand All @@ -73,7 +77,8 @@ func (ic *ContainerEngine) createServiceContainer(ctx context.Context, name stri
ReadOnly: true,
ReadWriteTmpFS: false,
// No need to spin up slirp etc.
Net: &entities.NetOptions{Network: specgen.Namespace{NSMode: specgen.NoNetwork}},
Net: &entities.NetOptions{Network: specgen.Namespace{NSMode: specgen.NoNetwork}},
StopTimeout: rtc.Engine.StopTimeout,
}

// Create and fill out the runtime spec.
Expand Down
2 changes: 1 addition & 1 deletion test/apiv2/20-containers.at
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ cid_top=$(jq -r '.Id' <<<"$output")
t GET containers/${cid_top}/json 200 \
.Config.Entrypoint[0]="top" \
.Config.Cmd='[]' \
.Config.StopTimeput="10" \
.Config.StopTimeout="10" \
.Path="top" \
.NetworkSettings.Networks.podman.NetworkID=podman
t POST containers/${cid_top}/start 204
Expand Down
3 changes: 3 additions & 0 deletions test/system/700-play.bats
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ EOF
run_podman container inspect $service_container --format "{{.State.Running}}"
is "$output" "true"

run_podman container inspect $service_container --format '{{.Config.StopTimeout}}'
is "$output" "10" "StopTimeout should be initialized to 10"

# Stop the *main* container and make sure that
# 1) The pod transitions to Exited
# 2) The service container is stopped
Expand Down

0 comments on commit f32e954

Please sign in to comment.