diff options
Diffstat (limited to 'cmd/podman/generate_kube.go')
-rw-r--r-- | cmd/podman/generate_kube.go | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/cmd/podman/generate_kube.go b/cmd/podman/generate_kube.go index c58372899..30818403b 100644 --- a/cmd/podman/generate_kube.go +++ b/cmd/podman/generate_kube.go @@ -3,13 +3,11 @@ package main import ( "fmt" "github.com/containers/libpod/cmd/podman/cliconfig" - "github.com/containers/libpod/cmd/podman/libpodruntime" - "github.com/containers/libpod/libpod" + "github.com/containers/libpod/pkg/adapter" podmanVersion "github.com/containers/libpod/version" "github.com/ghodss/yaml" "github.com/pkg/errors" "github.com/spf13/cobra" - "k8s.io/api/core/v1" ) var ( @@ -42,14 +40,12 @@ func init() { func generateKubeYAMLCmd(c *cliconfig.GenerateKubeValues) error { var ( - podYAML *v1.Pod - container *libpod.Container - err error - output []byte - pod *libpod.Pod + //podYAML *v1.Pod + err error + output []byte + //pod *libpod.Pod marshalledPod []byte marshalledService []byte - servicePorts []v1.ServicePort ) args := c.InputArgs @@ -57,43 +53,27 @@ func generateKubeYAMLCmd(c *cliconfig.GenerateKubeValues) error { return errors.Errorf("you must provide exactly one container|pod ID or name") } - runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand) + runtime, err := adapter.GetRuntime(&c.PodmanCommand) if err != nil { return errors.Wrapf(err, "could not get runtime") } defer runtime.Shutdown(false) - // Get the container in question - container, err = runtime.LookupContainer(args[0]) + podYAML, serviceYAML, err := runtime.GenerateKube(c) if err != nil { - pod, err = runtime.LookupPod(args[0]) - if err != nil { - return err - } - podYAML, servicePorts, err = pod.GenerateForKube() - } else { - if len(container.Dependencies()) > 0 { - return errors.Wrapf(libpod.ErrNotImplemented, "containers with dependencies") - } - podYAML, err = container.GenerateForKube() + return err } + // Marshall the results + marshalledPod, err = yaml.Marshal(podYAML) if err != nil { return err } - if c.Service { - serviceYAML := libpod.GenerateKubeServiceFromV1Pod(podYAML, servicePorts) marshalledService, err = yaml.Marshal(serviceYAML) if err != nil { return err } } - // Marshall the results - marshalledPod, err = yaml.Marshal(podYAML) - if err != nil { - return err - } - header := `# Generation of Kubernetes YAML is still under development! # # Save the output of this file and use kubectl create -f to import |