summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/generate.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-04-07 13:38:58 -0500
committerbaude <bbaude@redhat.com>2019-04-12 12:05:09 -0500
commit80b2c097fe333fd43634753b574d4b5bdf155b82 (patch)
treebfb3e032c0b6b4e7f08d087fa00d3919cdf62751 /pkg/varlinkapi/generate.go
parent4596c39655f7ff5e741adbc97aaa49bb3a9d453e (diff)
downloadpodman-80b2c097fe333fd43634753b574d4b5bdf155b82.tar.gz
podman-80b2c097fe333fd43634753b574d4b5bdf155b82.tar.bz2
podman-80b2c097fe333fd43634753b574d4b5bdf155b82.zip
podman-remote generate kube
Allow the ability to generate kube YAML from the podman remote-client. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/varlinkapi/generate.go')
-rw-r--r--pkg/varlinkapi/generate.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/pkg/varlinkapi/generate.go b/pkg/varlinkapi/generate.go
new file mode 100644
index 000000000..bc600c397
--- /dev/null
+++ b/pkg/varlinkapi/generate.go
@@ -0,0 +1,30 @@
+// +build varlink
+
+package varlinkapi
+
+import (
+ "encoding/json"
+ "github.com/containers/libpod/cmd/podman/shared"
+ iopodman "github.com/containers/libpod/cmd/podman/varlink"
+)
+
+// GenerateKube ...
+func (i *LibpodAPI) GenerateKube(call iopodman.VarlinkCall, name string, service bool) error {
+ pod, serv, err := shared.GenerateKube(name, service, i.Runtime)
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+ podB, err := json.Marshal(pod)
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+ servB, err := json.Marshal(serv)
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+
+ return call.ReplyGenerateKube(iopodman.KubePodService{
+ Pod: string(podB),
+ Service: string(servB),
+ })
+}