summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-06-25 23:39:11 -0400
committerMatthew Heon <matthew.heon@gmail.com>2018-07-24 16:12:31 -0400
commite838dcb4bf7dc35b1bcf21edad6a1f6c59d969ab (patch)
treec81880f61ae14d4cd412801c2539a88bf5cde540 /libpod/options.go
parentab9bc2187795b61a41dfa825ddf173ff92d531d1 (diff)
downloadpodman-e838dcb4bf7dc35b1bcf21edad6a1f6c59d969ab.tar.gz
podman-e838dcb4bf7dc35b1bcf21edad6a1f6c59d969ab.tar.bz2
podman-e838dcb4bf7dc35b1bcf21edad6a1f6c59d969ab.zip
Add constraint that dependencies must be in the same ns
Dependency containers must be in the same namespace, to ensure there are never problems resolving a dependency. Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go25
1 files changed, 23 insertions, 2 deletions
diff --git a/libpod/options.go b/libpod/options.go
index fb07d1edf..155c15333 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -284,6 +284,27 @@ func WithCNIPluginDir(dir string) RuntimeOption {
}
}
+// WithNamespace sets the namespace for libpod.
+// Namespace is the libpod namespace to use.
+// Namespaces are used to create scopes to separate containers and pods
+// in the state.
+// When namespace is set, libpod will only view containers and pods in
+// the same namespace. All containers and pods created will default to
+// the namespace set here.
+// A namespace of "", the empty string, is equivalent to no namespace,
+// and all containers and pods will be visible.
+func WithNamespace(ns string) RuntimeOption {
+ return func(rt *Runtime) error {
+ if rt.valid {
+ return ErrRuntimeFinalized
+ }
+
+ rt.config.Namespace = ns
+
+ return nil
+ }
+}
+
// Container Creation Options
// WithShmDir sets the directory that should be mounted on /dev/shm.
@@ -963,11 +984,11 @@ func WithRootFS(rootfs string) CtrCreateOption {
}
}
-// WithNamespace sets the namespace the container will be created in.
+// WithCtrNamespace sets the namespace the container will be created in.
// Namespaces are used to create separate views of Podman's state - runtimes can
// join a specific namespace and see only containers and pods in that namespace.
// Empty string namespaces are allowed, and correspond to a lack of namespace.
-func WithNamespace(ns string) CtrCreateOption {
+func WithCtrNamespace(ns string) CtrCreateOption {
return func(ctr *Container) error {
if ctr.valid {
return ErrCtrFinalized