diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-06-25 13:27:57 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@gmail.com> | 2018-07-24 16:12:31 -0400 |
commit | ab9bc2187795b61a41dfa825ddf173ff92d531d1 (patch) | |
tree | 9c47bd939d6a28a11c827ebe65c95a0a5a5507c4 /libpod/in_memory_state.go | |
parent | 24457873366bbd23d71b364a63037f34c652c04a (diff) | |
download | podman-ab9bc2187795b61a41dfa825ddf173ff92d531d1.tar.gz podman-ab9bc2187795b61a41dfa825ddf173ff92d531d1.tar.bz2 podman-ab9bc2187795b61a41dfa825ddf173ff92d531d1.zip |
Add namespaces and initial constraints to database
Add basic awareness of namespaces to the database. As part of
this, add constraints so containers can only be added to pods in
the same namespace.
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'libpod/in_memory_state.go')
-rw-r--r-- | libpod/in_memory_state.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/in_memory_state.go b/libpod/in_memory_state.go index 36077b9d1..cf2f43477 100644 --- a/libpod/in_memory_state.go +++ b/libpod/in_memory_state.go @@ -494,6 +494,11 @@ func (s *InMemoryState) AddContainerToPod(pod *Pod, ctr *Container) error { return errors.Wrapf(ErrInvalidArg, "container %s is not in pod %s", ctr.ID(), pod.ID()) } + if ctr.config.Namespace != pod.config.Namespace { + return errors.Wrapf(ErrNSMismatch, "container %s is in namespace %s and pod %s is in namespace %s", + ctr.ID(), ctr.config.Namespace, pod.ID(), pod.config.Namespace) + } + // Retrieve pod containers list podCtrs, ok := s.podContainers[pod.ID()] if !ok { |