summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/pods.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-12-17 07:45:51 -0800
committerGitHub <noreply@github.com>2018-12-17 07:45:51 -0800
commita1902dc48b11573ac35fa69ebdfe09def4857efd (patch)
tree28f285ee2c4503e12cbb84ade32e34d93876e05c /pkg/varlinkapi/pods.go
parentb21d47434f49e1d57fa2b0329ee90eef80b70714 (diff)
parent06d763d964c16fe0f19cb04f4f28f8c0ab8980bc (diff)
downloadpodman-a1902dc48b11573ac35fa69ebdfe09def4857efd.tar.gz
podman-a1902dc48b11573ac35fa69ebdfe09def4857efd.tar.bz2
podman-a1902dc48b11573ac35fa69ebdfe09def4857efd.zip
Merge pull request #1986 from baude/varlinkendpoints
Clean up some existing varlink endpoints
Diffstat (limited to 'pkg/varlinkapi/pods.go')
-rw-r--r--pkg/varlinkapi/pods.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/varlinkapi/pods.go b/pkg/varlinkapi/pods.go
index 461371497..6e758786a 100644
--- a/pkg/varlinkapi/pods.go
+++ b/pkg/varlinkapi/pods.go
@@ -2,6 +2,7 @@ package varlinkapi
import (
"encoding/json"
+ "github.com/containers/libpod/pkg/rootless"
"syscall"
"github.com/containers/libpod/cmd/podman/shared"
@@ -12,6 +13,10 @@ import (
// CreatePod ...
func (i *LibpodAPI) CreatePod(call iopodman.VarlinkCall, create iopodman.PodCreate) error {
var options []libpod.PodCreateOption
+
+ if create.InfraCommand != "" || create.InfraImage != "" {
+ return call.ReplyErrorOccurred("the infra-command and infra-image options are not supported yet")
+ }
if create.CgroupParent != "" {
options = append(options, libpod.WithPodCgroupParent(create.CgroupParent))
}
@@ -27,6 +32,21 @@ func (i *LibpodAPI) CreatePod(call iopodman.VarlinkCall, create iopodman.PodCrea
if len(create.Share) == 0 && create.Infra {
return call.ReplyErrorOccurred("You must share kernel namespaces to run an infra container")
}
+
+ if len(create.Publish) > 0 {
+ if !create.Infra {
+ return call.ReplyErrorOccurred("you must have an infra container to publish port bindings to the host")
+ }
+ if rootless.IsRootless() {
+ return call.ReplyErrorOccurred("rootless networking does not allow port binding to the host")
+ }
+ portBindings, err := shared.CreatePortBindings(create.Publish)
+ if err != nil {
+ return err
+ }
+ options = append(options, libpod.WithInfraContainerPorts(portBindings))
+
+ }
if create.Infra {
options = append(options, libpod.WithInfraContainer())
nsOptions, err := shared.GetNamespaceOptions(create.Share)