summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2017-12-05 17:50:29 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-14 23:59:21 +0000
commit16237fe067362f73d0ce5699cef9b3b62a45dd3e (patch)
tree72cbcec4c11e310897b733d653f22cae75ccc0f6 /libpod/options.go
parent2bc20dd4d212ebbf14ee0de8fae7ce115fe00926 (diff)
downloadpodman-16237fe067362f73d0ce5699cef9b3b62a45dd3e.tar.gz
podman-16237fe067362f73d0ce5699cef9b3b62a45dd3e.tar.bz2
podman-16237fe067362f73d0ce5699cef9b3b62a45dd3e.zip
Add networking configuration to the libpod DB
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #109 Approved by: mheon
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 1fe472ccc..3020ef51a 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -6,6 +6,7 @@ import (
"github.com/containers/storage"
"github.com/containers/storage/pkg/idtools"
+ "github.com/cri-o/ocicni/pkg/ocicni"
"github.com/pkg/errors"
)
@@ -402,6 +403,22 @@ func WithStopSignal(signal uint) CtrCreateOption {
}
}
+// WithNetNS indicates that the container should be given a new network
+// namespace with a minimal configuration
+// An optional array of port mappings can be provided
+func WithNetNS(portMappings []ocicni.PortMapping) CtrCreateOption {
+ return func(ctr *Container) error {
+ if ctr.valid {
+ return ErrCtrFinalized
+ }
+
+ ctr.config.CreateNetNS = true
+ copy(ctr.config.PortMappings, portMappings)
+
+ return nil
+ }
+}
+
// Pod Creation Options
// WithPodName sets the name of the pod