From 69d7407afbe76eb7553b84193f93281b9c5ce904 Mon Sep 17 00:00:00 2001 From: Niall Crowe Date: Wed, 27 Jul 2022 23:16:57 +0100 Subject: switch from "kube/play" endpoint to "play/kube" endpoint. When podman kube play was added the endpoint for the kube play/play kube commands was switched from the "play kube" endpoint to the new "kube play" endpoint. This caused issues with the remote client, requiring the need to use the "play kube" endpoint again in order to avoid these issues. Signed-off-by: Niall Crowe --- pkg/api/handlers/swagger/responses.go | 2 +- pkg/api/server/register_kube.go | 82 ----------------------------------- pkg/api/server/register_play.go | 82 +++++++++++++++++++++++++++++++++++ pkg/api/server/server.go | 2 +- 4 files changed, 84 insertions(+), 84 deletions(-) delete mode 100644 pkg/api/server/register_kube.go create mode 100644 pkg/api/server/register_play.go (limited to 'pkg/api') diff --git a/pkg/api/handlers/swagger/responses.go b/pkg/api/handlers/swagger/responses.go index 5731f8edd..93a508b39 100644 --- a/pkg/api/handlers/swagger/responses.go +++ b/pkg/api/handlers/swagger/responses.go @@ -71,7 +71,7 @@ type imagesRemoveResponseLibpod struct { // PlayKube response // swagger:response -type kubePlayResponseLibpod struct { +type playKubeResponseLibpod struct { // in:body Body entities.PlayKubeReport } diff --git a/pkg/api/server/register_kube.go b/pkg/api/server/register_kube.go deleted file mode 100644 index 6ae9e8123..000000000 --- a/pkg/api/server/register_kube.go +++ /dev/null @@ -1,82 +0,0 @@ -package server - -import ( - "net/http" - - "github.com/containers/podman/v4/pkg/api/handlers/libpod" - "github.com/gorilla/mux" -) - -func (s *APIServer) registerKubeHandlers(r *mux.Router) error { - // swagger:operation POST /libpod/kube/play libpod KubePlayLibpod - // --- - // tags: - // - containers - // - pods - // summary: Play a Kubernetes YAML file. - // description: Create and run pods based on a Kubernetes YAML file (pod or service kind). - // parameters: - // - in: query - // name: network - // type: array - // description: USe the network mode or specify an array of networks. - // items: - // type: string - // - in: query - // name: tlsVerify - // type: boolean - // default: true - // description: Require HTTPS and verify signatures when contacting registries. - // - in: query - // name: logDriver - // type: string - // description: Logging driver for the containers in the pod. - // - in: query - // name: start - // type: boolean - // default: true - // description: Start the pod after creating it. - // - in: query - // name: staticIPs - // type: array - // description: Static IPs used for the pods. - // items: - // type: string - // - in: query - // name: staticMACs - // type: array - // description: Static MACs used for the pods. - // items: - // type: string - // - in: body - // name: request - // description: Kubernetes YAML file. - // schema: - // type: string - // produces: - // - application/json - // responses: - // 200: - // $ref: "#/responses/kubePlayResponseLibpod" - // 500: - // $ref: "#/responses/internalError" - r.HandleFunc(VersionedPath("/libpod/kube/play"), s.APIHandler(libpod.KubePlay)).Methods(http.MethodPost) - r.HandleFunc(VersionedPath("/libpod/play/kube"), s.APIHandler(libpod.PlayKube)).Methods(http.MethodPost) - // swagger:operation DELETE /libpod/kube/play libpod KubePlayDownLibpod - // --- - // tags: - // - containers - // - pods - // summary: Remove pods from kube play - // description: Tears down pods defined in a YAML file - // produces: - // - application/json - // responses: - // 200: - // $ref: "#/responses/kubePlayResponseLibpod" - // 500: - // $ref: "#/responses/internalError" - r.HandleFunc(VersionedPath("/libpod/kube/play"), s.APIHandler(libpod.KubePlayDown)).Methods(http.MethodDelete) - r.HandleFunc(VersionedPath("/libpod/play/kube"), s.APIHandler(libpod.PlayKubeDown)).Methods(http.MethodDelete) - return nil -} diff --git a/pkg/api/server/register_play.go b/pkg/api/server/register_play.go new file mode 100644 index 000000000..76e150504 --- /dev/null +++ b/pkg/api/server/register_play.go @@ -0,0 +1,82 @@ +package server + +import ( + "net/http" + + "github.com/containers/podman/v4/pkg/api/handlers/libpod" + "github.com/gorilla/mux" +) + +func (s *APIServer) registerPlayHandlers(r *mux.Router) error { + // swagger:operation POST /libpod/play/kube libpod PlayKubeLibpod + // --- + // tags: + // - containers + // - pods + // summary: Play a Kubernetes YAML file. + // description: Create and run pods based on a Kubernetes YAML file (pod or service kind). + // parameters: + // - in: query + // name: network + // type: array + // description: USe the network mode or specify an array of networks. + // items: + // type: string + // - in: query + // name: tlsVerify + // type: boolean + // default: true + // description: Require HTTPS and verify signatures when contacting registries. + // - in: query + // name: logDriver + // type: string + // description: Logging driver for the containers in the pod. + // - in: query + // name: start + // type: boolean + // default: true + // description: Start the pod after creating it. + // - in: query + // name: staticIPs + // type: array + // description: Static IPs used for the pods. + // items: + // type: string + // - in: query + // name: staticMACs + // type: array + // description: Static MACs used for the pods. + // items: + // type: string + // - in: body + // name: request + // description: Kubernetes YAML file. + // schema: + // type: string + // produces: + // - application/json + // responses: + // 200: + // $ref: "#/responses/playKubeResponseLibpod" + // 500: + // $ref: "#/responses/internalError" + r.HandleFunc(VersionedPath("/libpod/play/kube"), s.APIHandler(libpod.PlayKube)).Methods(http.MethodPost) + r.HandleFunc(VersionedPath("/libpod/kube/play"), s.APIHandler(libpod.KubePlay)).Methods(http.MethodPost) + // swagger:operation DELETE /libpod/play/kube libpod PlayKubeDownLibpod + // --- + // tags: + // - containers + // - pods + // summary: Remove pods from kube play + // description: Tears down pods defined in a YAML file + // produces: + // - application/json + // responses: + // 200: + // $ref: "#/responses/playKubeResponseLibpod" + // 500: + // $ref: "#/responses/internalError" + r.HandleFunc(VersionedPath("/libpod/play/kube"), s.APIHandler(libpod.PlayKubeDown)).Methods(http.MethodDelete) + r.HandleFunc(VersionedPath("/libpod/kube/play"), s.APIHandler(libpod.KubePlayDown)).Methods(http.MethodDelete) + return nil +} diff --git a/pkg/api/server/server.go b/pkg/api/server/server.go index a6d8b5e4c..5482a8ec2 100644 --- a/pkg/api/server/server.go +++ b/pkg/api/server/server.go @@ -126,11 +126,11 @@ func newServer(runtime *libpod.Runtime, listener net.Listener, opts entities.Ser server.registerHealthCheckHandlers, server.registerImagesHandlers, server.registerInfoHandlers, - server.registerKubeHandlers, server.registerManifestHandlers, server.registerMonitorHandlers, server.registerNetworkHandlers, server.registerPingHandlers, + server.registerPlayHandlers, server.registerPluginsHandlers, server.registerPodsHandlers, server.registerSecretHandlers, -- cgit v1.2.3-54-g00ecf