mirror of
https://github.com/containers/podman.git
synced 2025-12-04 20:28:40 +08:00
remote: fix podman-remote kube play --publish-all
Fix `podman kube play --publish-all` to work in remote environment. Signed-off-by: Tsubasa Watanabe <w.tsubasa@fujitsu.com>
This commit is contained in:
@@ -27,6 +27,7 @@ func KubePlay(w http.ResponseWriter, r *http.Request) {
|
|||||||
NoTrunc bool `schema:"noTrunc"`
|
NoTrunc bool `schema:"noTrunc"`
|
||||||
Replace bool `schema:"replace"`
|
Replace bool `schema:"replace"`
|
||||||
PublishPorts []string `schema:"publishPorts"`
|
PublishPorts []string `schema:"publishPorts"`
|
||||||
|
PublishAllPorts bool `schema:"publishAllPorts"`
|
||||||
ServiceContainer bool `schema:"serviceContainer"`
|
ServiceContainer bool `schema:"serviceContainer"`
|
||||||
Start bool `schema:"start"`
|
Start bool `schema:"start"`
|
||||||
StaticIPs []string `schema:"staticIPs"`
|
StaticIPs []string `schema:"staticIPs"`
|
||||||
@@ -97,6 +98,7 @@ func KubePlay(w http.ResponseWriter, r *http.Request) {
|
|||||||
NoHosts: query.NoHosts,
|
NoHosts: query.NoHosts,
|
||||||
Password: password,
|
Password: password,
|
||||||
PublishPorts: query.PublishPorts,
|
PublishPorts: query.PublishPorts,
|
||||||
|
PublishAllPorts: query.PublishAllPorts,
|
||||||
Quiet: true,
|
Quiet: true,
|
||||||
Replace: query.Replace,
|
Replace: query.Replace,
|
||||||
ServiceContainer: query.ServiceContainer,
|
ServiceContainer: query.ServiceContainer,
|
||||||
|
|||||||
@@ -53,6 +53,10 @@ func (s *APIServer) registerKubeHandlers(r *mux.Router) error {
|
|||||||
// items:
|
// items:
|
||||||
// type: string
|
// type: string
|
||||||
// - in: query
|
// - in: query
|
||||||
|
// name: publishAllPorts
|
||||||
|
// type: boolean
|
||||||
|
// description: Whether to publish all ports defined in the K8S YAML file (containerPort, hostPort), if false only hostPort will be published
|
||||||
|
// - in: query
|
||||||
// name: replace
|
// name: replace
|
||||||
// type: boolean
|
// type: boolean
|
||||||
// default: false
|
// default: false
|
||||||
|
|||||||
@@ -5644,6 +5644,18 @@ spec:
|
|||||||
testHTTPServer("19003", false, "podman rulez")
|
testHTTPServer("19003", false, "podman rulez")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("podman play kube should publish containerPort with --publish-all", func() {
|
||||||
|
SkipIfRootless("rootlessport can't expose privileged port 80")
|
||||||
|
err := writeYaml(publishPortsPodWithContainerPort, kubeYaml)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
|
kube := podmanTest.Podman([]string{"kube", "play", "--publish-all=true", kubeYaml})
|
||||||
|
kube.WaitWithDefaultTimeout()
|
||||||
|
Expect(kube).Should(Exit(0))
|
||||||
|
|
||||||
|
testHTTPServer("80", false, "podman rulez")
|
||||||
|
})
|
||||||
|
|
||||||
It("with Host Ports - curl should succeed", func() {
|
It("with Host Ports - curl should succeed", func() {
|
||||||
err := writeYaml(publishPortsPodWithContainerHostPort, kubeYaml)
|
err := writeYaml(publishPortsPodWithContainerHostPort, kubeYaml)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|||||||
Reference in New Issue
Block a user