mirror of
https://github.com/containers/podman.git
synced 2025-06-30 15:49:03 +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:
@ -27,6 +27,7 @@ var (
|
||||
handlerOrder []string
|
||||
shutdownInhibit sync.RWMutex
|
||||
logrus = logrusImport.WithField("PID", os.Getpid())
|
||||
ErrNotStarted = errors.New("shutdown signal handler has not yet been started")
|
||||
)
|
||||
|
||||
// Start begins handling SIGTERM and SIGINT and will run the given on-signal
|
||||
@ -84,7 +85,7 @@ func Start() error {
|
||||
// Stop the shutdown signal handler.
|
||||
func Stop() error {
|
||||
if cancelChan == nil {
|
||||
return errors.New("shutdown signal handler has not yet been started")
|
||||
return ErrNotStarted
|
||||
}
|
||||
if stopped {
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user