mirror of
https://github.com/containers/podman.git
synced 2025-05-21 00:56:36 +08:00
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>
This commit is contained in:
@ -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")
|
||||
|
Reference in New Issue
Block a user