summaryrefslogtreecommitdiff
path: root/cmd/podman/generate_kube.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-04-12 11:03:20 -0700
committerGitHub <noreply@github.com>2019-04-12 11:03:20 -0700
commit89ffcf9df9d83bc8e0ea7c8004591fb0825117cf (patch)
treee6e12ffa729da39447fd673bd2141ede12a26fb3 /cmd/podman/generate_kube.go
parent61fa40b25679f864db5b5b375d512a9f1264e31f (diff)
parent80b2c097fe333fd43634753b574d4b5bdf155b82 (diff)
downloadpodman-89ffcf9df9d83bc8e0ea7c8004591fb0825117cf.tar.gz
podman-89ffcf9df9d83bc8e0ea7c8004591fb0825117cf.tar.bz2
podman-89ffcf9df9d83bc8e0ea7c8004591fb0825117cf.zip
Merge pull request #2903 from baude/remotegenkube
podman-remote generate kube
Diffstat (limited to 'cmd/podman/generate_kube.go')
-rw-r--r--cmd/podman/generate_kube.go40
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