mirror of
https://github.com/containers/podman.git
synced 2025-10-17 11:14:40 +08:00
play kube: Add --wait option
Add a way to keep play kube running in the foreground and terminating all pods after receiving a a SIGINT or SIGTERM signal. The pods will also be cleaned up after the containers in it have exited. If an error occurrs during kube play, any resources created till the error point will be cleane up also. Add tests for the various scenarios. Fixes #14522 Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
This commit is contained in:
@ -134,10 +134,12 @@ func (p *Pod) maybeStopServiceContainer() error {
|
||||
return
|
||||
}
|
||||
logrus.Debugf("Stopping service container %s", serviceCtr.ID())
|
||||
if err := serviceCtr.Stop(); err != nil {
|
||||
if !errors.Is(err, define.ErrCtrStopped) {
|
||||
logrus.Errorf("Stopping service container %s: %v", serviceCtr.ID(), err)
|
||||
}
|
||||
if err := serviceCtr.Stop(); err != nil && !errors.Is(err, define.ErrCtrStopped) {
|
||||
// Log this in debug mode so that we don't print out an error and confuse the user
|
||||
// when the service container can't be stopped because it is in created state
|
||||
// This can happen when an error happens during kube play and we are trying to
|
||||
// clean up after the error.
|
||||
logrus.Debugf("Error stopping service container %s: %v", serviceCtr.ID(), err)
|
||||
}
|
||||
})
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user