summaryrefslogtreecommitdiff
path: root/libpod/runtime_pod_linux.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-07-19 14:29:00 -0400
committerMatthew Heon <matthew.heon@gmail.com>2018-07-24 16:12:31 -0400
commitfc95f68247248e4cb029440e2fe4ba0b0df8049c (patch)
tree1ecb382d8e9d8f512d7aea46129b3804b4d1983d /libpod/runtime_pod_linux.go
parent3ae0c80806b68f712756fd660d06449e71eb41b7 (diff)
downloadpodman-fc95f68247248e4cb029440e2fe4ba0b0df8049c.tar.gz
podman-fc95f68247248e4cb029440e2fe4ba0b0df8049c.tar.bz2
podman-fc95f68247248e4cb029440e2fe4ba0b0df8049c.zip
Set namespace for new pods/containers based on runtime
New containers and pods will default to the namespace of the runtime, but this can be overridden by With... options if desired. Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'libpod/runtime_pod_linux.go')
-rw-r--r--libpod/runtime_pod_linux.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/libpod/runtime_pod_linux.go b/libpod/runtime_pod_linux.go
index 25340abdb..3355e4322 100644
--- a/libpod/runtime_pod_linux.go
+++ b/libpod/runtime_pod_linux.go
@@ -27,6 +27,12 @@ func (r *Runtime) NewPod(options ...PodCreateOption) (*Pod, error) {
return nil, errors.Wrapf(err, "error creating pod")
}
+ // Set default namespace to runtime's namespace
+ // Do so before options run so they can override it
+ if r.config.Namespace != "" {
+ pod.config.Namespace = r.config.Namespace
+ }
+
for _, option := range options {
if err := option(pod); err != nil {
return nil, errors.Wrapf(err, "error running pod create option")