Merge pull request #21103 from fj-tsubasa/remote-kube-play-publish-all

remote: fix podman-remote kube play --publish-all
This commit is contained in:
openshift-merge-bot[bot] 2024-01-03 12:41:41 +00:00 committed by GitHub
commit 185fa5ba3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 0 deletions

View File

@ -27,6 +27,7 @@ func KubePlay(w http.ResponseWriter, r *http.Request) {
NoTrunc bool `schema:"noTrunc"`
Replace bool `schema:"replace"`
PublishPorts []string `schema:"publishPorts"`
PublishAllPorts bool `schema:"publishAllPorts"`
ServiceContainer bool `schema:"serviceContainer"`
Start bool `schema:"start"`
StaticIPs []string `schema:"staticIPs"`
@ -97,6 +98,7 @@ func KubePlay(w http.ResponseWriter, r *http.Request) {
NoHosts: query.NoHosts,
Password: password,
PublishPorts: query.PublishPorts,
PublishAllPorts: query.PublishAllPorts,
Quiet: true,
Replace: query.Replace,
ServiceContainer: query.ServiceContainer,

View File

@ -53,6 +53,10 @@ func (s *APIServer) registerKubeHandlers(r *mux.Router) error {
// items:
// type: string
// - 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
// type: boolean
// default: false

View File

@ -5644,6 +5644,18 @@ spec:
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() {
err := writeYaml(publishPortsPodWithContainerHostPort, kubeYaml)
Expect(err).ToNot(HaveOccurred())