From 749ee2a10ed689a06da699659c59872c0ed770d7 Mon Sep 17 00:00:00 2001 From: baude Date: Wed, 2 Dec 2020 16:06:31 -0600 Subject: 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 --- cmd/podman/generate/kube.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cmd/podman') diff --git a/cmd/podman/generate/kube.go b/cmd/podman/generate/kube.go index e47bd35b5..0517db19a 100644 --- a/cmd/podman/generate/kube.go +++ b/cmd/podman/generate/kube.go @@ -17,16 +17,16 @@ import ( var ( kubeOptions = entities.GenerateKubeOptions{} kubeFile = "" - kubeDescription = `Command generates Kubernetes pod and service YAML (v1 specification) from a Podman container or pod. + kubeDescription = `Command generates Kubernetes pod and service YAML (v1 specification) from Podman containers or a pod. Whether the input is for a container or pod, Podman will always generate the specification as a pod.` kubeCmd = &cobra.Command{ - Use: "kube [options] CONTAINER | POD", + Use: "kube [options] CONTAINER... | POD", Short: "Generate Kubernetes YAML from a container or pod.", Long: kubeDescription, RunE: kube, - Args: cobra.ExactArgs(1), + Args: cobra.MinimumNArgs(1), ValidArgsFunction: common.AutocompleteContainersAndPods, Example: `podman generate kube ctrID podman generate kube podID @@ -51,7 +51,7 @@ func init() { } func kube(cmd *cobra.Command, args []string) error { - report, err := registry.ContainerEngine().GenerateKube(registry.GetContext(), args[0], kubeOptions) + report, err := registry.ContainerEngine().GenerateKube(registry.GetContext(), args, kubeOptions) if err != nil { return err } -- cgit v1.2.3-54-g00ecf