mirror of
https://github.com/containers/podman.git
synced 2025-12-01 02:27:13 +08:00
add {generate,play} kube
Add the `podman generate kube` and `podman play kube` command. The code has largely been copied from Podman v1 but restructured to not leak the K8s core API into the (remote) client. Both commands are added in the same commit to allow for enabling the tests at the same time. Move some exports from `cmd/podman/common` to the appropriate places in the backend to avoid circular dependencies. Move definitions of label annotations to `libpod/define` and set the security-opt labels in the frontend to make kube tests pass. Implement rest endpoints, bindings and the tunnel interface. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
41
pkg/api/server/register_generate.go
Normal file
41
pkg/api/server/register_generate.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/containers/libpod/pkg/api/handlers/libpod"
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
func (s *APIServer) registerGenerateHandlers(r *mux.Router) error {
|
||||
// swagger:operation GET /libpod/generate/{name:.*}/kube libpod libpodGenerateKube
|
||||
// ---
|
||||
// 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: path
|
||||
// name: name:.*
|
||||
// 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:
|
||||
// - application/json
|
||||
// responses:
|
||||
// 200:
|
||||
// description: no error
|
||||
// schema:
|
||||
// type: string
|
||||
// format: binary
|
||||
// 500:
|
||||
// $ref: "#/responses/InternalError"
|
||||
r.HandleFunc(VersionedPath("/libpod/generate/{name:.*}/kube"), s.APIHandler(libpod.GenerateKube)).Methods(http.MethodGet)
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user