summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-14 16:16:08 +0200
committerGitHub <noreply@github.com>2019-08-14 16:16:08 +0200
commit4823cf8fcc460f2d4f8707ff603234baff9d452a (patch)
tree97c466bae96c8326fadf8833400bb9312eb1266c
parenta734b53357a84d5156e2902113e72d9384f9515b (diff)
parentfb9e1d7d9f332e513d392c7b8ccf1093807bb1a0 (diff)
downloadpodman-4823cf8fcc460f2d4f8707ff603234baff9d452a.tar.gz
podman-4823cf8fcc460f2d4f8707ff603234baff9d452a.tar.bz2
podman-4823cf8fcc460f2d4f8707ff603234baff9d452a.zip
Merge pull request #3809 from chenzhiwei/fix-play-kube
Fix play kube command in pod yaml
-rw-r--r--pkg/adapter/pods.go2
-rw-r--r--test/e2e/play_kube_test.go24
2 files changed, 26 insertions, 0 deletions
diff --git a/pkg/adapter/pods.go b/pkg/adapter/pods.go
index e25238956..2743dfdc6 100644
--- a/pkg/adapter/pods.go
+++ b/pkg/adapter/pods.go
@@ -707,6 +707,8 @@ func kubeContainerToCreateConfig(ctx context.Context, containerYAML v1.Container
return nil, errors.Errorf("No command specified in container YAML or as CMD or ENTRYPOINT in this image for %s", containerConfig.Name)
}
+ containerConfig.UserCommand = containerConfig.Command
+
containerConfig.StopSignal = 15
// If the user does not pass in ID mappings, just set to basics
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 331412a39..b0a9f2ead 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -140,6 +140,30 @@ var _ = Describe("Podman generate kube", func() {
Expect(inspect.OutputToString()).To(ContainSubstring(ctrCmd[0]))
})
+ It("podman play kube test correct output", func() {
+ ctrName := "testCtr"
+ ctrCmd := []string{"echo", "hello"}
+ testContainer := Container{ctrCmd, ALPINE, ctrName, false, nil, nil}
+ tempFile := filepath.Join(podmanTest.TempDir, "kube.yaml")
+
+ err := generateKubeYaml([]Container{testContainer}, tempFile)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", tempFile})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ logs := podmanTest.Podman([]string{"logs", ctrName})
+ logs.WaitWithDefaultTimeout()
+ Expect(logs.ExitCode()).To(Equal(0))
+ Expect(logs.OutputToString()).To(ContainSubstring("hello"))
+
+ inspect := podmanTest.Podman([]string{"inspect", ctrName, "--format", "'{{ .Config.Cmd }}'"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect.OutputToString()).To(ContainSubstring("hello"))
+ })
+
It("podman play kube cap add", func() {
ctrName := "testCtr"
ctrCmd := []string{"cat", "/proc/self/status"}