Ensure container dependencies are part of the same pod

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #558
Approved by: rhatdan
This commit is contained in:
Matthew Heon
2018-03-28 09:11:19 -04:00
committed by Atomic Bot
parent 5b6f59e36c
commit ecda694a92

View File

@ -413,6 +413,10 @@ func (s *BoltState) addContainer(ctr *Container, pod *Pod) error {
if depCtrPod == nil {
return errors.Wrapf(ErrInvalidArg, "container %s depends on container %s which is not in pod %s", ctr.ID(), dependsCtr, pod.ID())
}
if string(depCtrPod) != pod.ID() {
return errors.Wrapf(ErrInvalidArg, "container %s depends on container %s which is in a different pod (%s)", ctr.ID(), dependsCtr, string(depCtrPod))
}
} else {
// If we're not part of a pod, we cannot depend on containets in a pod
if depCtrPod != nil {