summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/play.go
diff options
context:
space:
mode:
authorAlban Bedel <albeu@free.fr>2020-11-16 21:46:42 +0100
committerAlban Bedel <albeu@free.fr>2020-11-17 20:00:58 +0100
commit7ab936eafad504fd6a0b7bfec3f6dafe322ad09d (patch)
tree5ccf2a4f68bd59f089d2e34f62e240a140b2b9a3 /pkg/domain/infra/abi/play.go
parent12de330094fdcd2e2fd0d10d5e5ddd962193de8b (diff)
downloadpodman-7ab936eafad504fd6a0b7bfec3f6dafe322ad09d.tar.gz
podman-7ab936eafad504fd6a0b7bfec3f6dafe322ad09d.tar.bz2
podman-7ab936eafad504fd6a0b7bfec3f6dafe322ad09d.zip
Add an option to control if play kube should start the pod
Having play kube start the pod is not always appropriate, one might for example like to have the pod running as a set of systemd services. Add a `start` option to the command line and API to control if the pod should be started or not; it defaults to true for backward compatibility. Signed-off-by: Alban Bedel <albeu@free.fr>
Diffstat (limited to 'pkg/domain/infra/abi/play.go')
-rw-r--r--pkg/domain/infra/abi/play.go26
1 files changed, 14 insertions, 12 deletions
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index c0948e099..4bcc6469c 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -297,20 +297,22 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
containers = append(containers, ctr)
}
- //start the containers
- podStartErrors, err := pod.Start(ctx)
- if err != nil {
- return nil, err
- }
+ if options.Start != types.OptionalBoolFalse {
+ //start the containers
+ podStartErrors, err := pod.Start(ctx)
+ if err != nil {
+ return nil, err
+ }
- // Previous versions of playkube started containers individually and then
- // looked for errors. Because we now use the uber-Pod start call, we should
- // iterate the map of possible errors and return one if there is a problem. This
- // keeps the behavior the same
+ // Previous versions of playkube started containers individually and then
+ // looked for errors. Because we now use the uber-Pod start call, we should
+ // iterate the map of possible errors and return one if there is a problem. This
+ // keeps the behavior the same
- for _, e := range podStartErrors {
- if e != nil {
- return nil, e
+ for _, e := range podStartErrors {
+ if e != nil {
+ return nil, e
+ }
}
}