summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod/generate.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2020-12-02 16:06:31 -0600
committerbaude <bbaude@redhat.com>2020-12-07 11:34:39 -0600
commit749ee2a10ed689a06da699659c59872c0ed770d7 (patch)
tree496d31fdaa07af5778214d6c22ea0222f50ded9b /pkg/api/handlers/libpod/generate.go
parente6f80fa61aa082d2226b8258ea247186451d84d3 (diff)
downloadpodman-749ee2a10ed689a06da699659c59872c0ed770d7.tar.gz
podman-749ee2a10ed689a06da699659c59872c0ed770d7.tar.bz2
podman-749ee2a10ed689a06da699659c59872c0ed770d7.zip
generate kube on multiple containers
add the ability to add multiple containers into a single k8s pod instead of just one. also fixed some bugs in the resulting yaml where an empty service description was being added on error causing the k8s validation to fail. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/api/handlers/libpod/generate.go')
-rw-r--r--pkg/api/handlers/libpod/generate.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/api/handlers/libpod/generate.go b/pkg/api/handlers/libpod/generate.go
index 33bb75391..b3b8c1f16 100644
--- a/pkg/api/handlers/libpod/generate.go
+++ b/pkg/api/handlers/libpod/generate.go
@@ -60,7 +60,8 @@ func GenerateKube(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
decoder := r.Context().Value("decoder").(*schema.Decoder)
query := struct {
- Service bool `schema:"service"`
+ Names []string `schema:"names"`
+ Service bool `schema:"service"`
}{
// Defaults would go here.
}
@@ -73,7 +74,7 @@ func GenerateKube(w http.ResponseWriter, r *http.Request) {
containerEngine := abi.ContainerEngine{Libpod: runtime}
options := entities.GenerateKubeOptions{Service: query.Service}
- report, err := containerEngine.GenerateKube(r.Context(), utils.GetName(r), options)
+ report, err := containerEngine.GenerateKube(r.Context(), query.Names, options)
if err != nil {
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "error generating YAML"))
return