diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-09-18 06:19:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-18 06:19:19 -0400 |
commit | fc131a207ebaf6aa16717781bf78c78690f0408e (patch) | |
tree | 01d147dc5f5a12a380d1f795d6f9e2c58a7012bf /pkg/domain/infra/abi/play.go | |
parent | 4b037d2acccd0de8a09fff91be6c266739e68694 (diff) | |
parent | f0ccac199bd500729dabc8948bbd4ddd0124231e (diff) | |
download | podman-fc131a207ebaf6aa16717781bf78c78690f0408e.tar.gz podman-fc131a207ebaf6aa16717781bf78c78690f0408e.tar.bz2 podman-fc131a207ebaf6aa16717781bf78c78690f0408e.zip |
Merge pull request #7671 from zhangguanzhang/play-kube-handle-restartPolicy
handle the restartPolicy for play kube and generate kube
Diffstat (limited to 'pkg/domain/infra/abi/play.go')
-rw-r--r-- | pkg/domain/infra/abi/play.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go index 659cc799c..aa6aeede2 100644 --- a/pkg/domain/infra/abi/play.go +++ b/pkg/domain/infra/abi/play.go @@ -299,6 +299,18 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY return nil, err } + var ctrRestartPolicy string + switch podYAML.Spec.RestartPolicy { + case v1.RestartPolicyAlways: + ctrRestartPolicy = libpod.RestartPolicyAlways + case v1.RestartPolicyOnFailure: + ctrRestartPolicy = libpod.RestartPolicyOnFailure + case v1.RestartPolicyNever: + ctrRestartPolicy = libpod.RestartPolicyNo + default: // Default to Always + ctrRestartPolicy = libpod.RestartPolicyAlways + } + containers := make([]*libpod.Container, 0, len(podYAML.Spec.Containers)) for _, container := range podYAML.Spec.Containers { pullPolicy := util.PullImageMissing @@ -326,6 +338,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY if err != nil { return nil, err } + conf.RestartPolicy = ctrRestartPolicy ctr, err := createconfig.CreateContainerFromCreateConfig(ctx, ic.Libpod, conf, pod) if err != nil { return nil, err |