diff options
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/kube.go | 18 | ||||
-rw-r--r-- | libpod/oci_attach_linux.go | 2 | ||||
-rw-r--r-- | libpod/runtime_pod_infra_linux.go | 4 |
3 files changed, 23 insertions, 1 deletions
diff --git a/libpod/kube.go b/libpod/kube.go index 9d5cbe68b..f83e99d82 100644 --- a/libpod/kube.go +++ b/libpod/kube.go @@ -77,6 +77,24 @@ func (p *Pod) GenerateForKube() (*v1.Pod, []v1.ServicePort, error) { } pod.Spec.HostAliases = extraHost + // vendor/k8s.io/api/core/v1/types.go: v1.Container cannot save restartPolicy + // so set it at here + for _, ctr := range allContainers { + if !ctr.IsInfra() { + switch ctr.Config().RestartPolicy { + case RestartPolicyAlways: + pod.Spec.RestartPolicy = v1.RestartPolicyAlways + case RestartPolicyOnFailure: + pod.Spec.RestartPolicy = v1.RestartPolicyOnFailure + case RestartPolicyNo: + pod.Spec.RestartPolicy = v1.RestartPolicyNever + default: // some pod create from cmdline, such as "", so set it to Never + pod.Spec.RestartPolicy = v1.RestartPolicyNever + } + break + } + } + if p.SharesPID() { // unfortunately, go doesn't have a nice way to specify a pointer to a bool b := true diff --git a/libpod/oci_attach_linux.go b/libpod/oci_attach_linux.go index 74af449ed..149ee813b 100644 --- a/libpod/oci_attach_linux.go +++ b/libpod/oci_attach_linux.go @@ -14,7 +14,7 @@ import ( "github.com/containers/podman/v2/pkg/errorhandling" "github.com/containers/podman/v2/pkg/kubeutils" "github.com/containers/podman/v2/utils" - "github.com/docker/docker/pkg/term" + "github.com/moby/term" "github.com/pkg/errors" "github.com/sirupsen/logrus" "golang.org/x/sys/unix" diff --git a/libpod/runtime_pod_infra_linux.go b/libpod/runtime_pod_infra_linux.go index 164068638..570cdd38f 100644 --- a/libpod/runtime_pod_infra_linux.go +++ b/libpod/runtime_pod_infra_linux.go @@ -50,7 +50,11 @@ func (r *Runtime) makeInfraContainer(ctx context.Context, p *Pod, imgName, rawIm entryPoint = config.Entrypoint entryCmd = config.Entrypoint } + } else { // so use the InfraCommand + entrypointSet = true + entryCmd = entryPoint } + if len(config.Cmd) > 0 { // We can't use the default pause command, since we're // sourcing from the image. If we didn't already set an |