aboutsummaryrefslogtreecommitdiff
path: root/pkg/varlinkapi
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 /pkg/varlinkapi
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 'pkg/varlinkapi')
-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),
+ })
+}