diff options
author | Niall Crowe <nicrowe@redhat.com> | 2022-08-04 09:02:54 +0100 |
---|---|---|
committer | Niall Crowe <nicrowe@redhat.com> | 2022-08-11 16:58:24 +0100 |
commit | d856fb43e11b3a4a93b423d330ce3435afddde4b (patch) | |
tree | b5533938756de79d6340e3a5802ac1a1700fd142 /pkg/api/server/register_kube.go | |
parent | 92bbae40de3c48ee6b4692ab9e4d7cc14db242bb (diff) | |
download | podman-d856fb43e11b3a4a93b423d330ce3435afddde4b.tar.gz podman-d856fb43e11b3a4a93b423d330ce3435afddde4b.tar.bz2 podman-d856fb43e11b3a4a93b423d330ce3435afddde4b.zip |
Add "podman kube generate" command
"podman kube generate" creates Kubernetes YAML from Podman containers,
pods or volumes. Users will still be able to use "podman generate
kube" as an alias of "kube generate".
Signed-off-by: Niall Crowe <nicrowe@redhat.com>
Diffstat (limited to 'pkg/api/server/register_kube.go')
-rw-r--r-- | pkg/api/server/register_kube.go | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/pkg/api/server/register_kube.go b/pkg/api/server/register_kube.go new file mode 100644 index 000000000..0c3cd1d04 --- /dev/null +++ b/pkg/api/server/register_kube.go @@ -0,0 +1,115 @@ +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/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) + // swagger:operation GET /libpod/generate/kube libpod GenerateKubeLibpod + // --- + // tags: + // - containers + // - pods + // summary: Generate a Kubernetes YAML file. + // description: Generate Kubernetes YAML based on a pod or container. + // parameters: + // - in: query + // name: names + // type: array + // items: + // type: string + // required: true + // description: Name or ID of the container or pod. + // - in: query + // name: service + // type: boolean + // default: false + // description: Generate YAML for a Kubernetes service object. + // produces: + // - text/vnd.yaml + // - application/json + // responses: + // 200: + // description: Kubernetes YAML file describing pod + // schema: + // type: string + // format: binary + // 500: + // $ref: "#/responses/internalError" + r.HandleFunc(VersionedPath("/libpod/generate/kube"), s.APIHandler(libpod.GenerateKube)).Methods(http.MethodGet) + r.HandleFunc(VersionedPath("/libpod/kube/generate"), s.APIHandler(libpod.KubeGenerate)).Methods(http.MethodGet) + return nil +} |