Skip to content

Commit

Permalink
Merge pull request #2545 from haircommander/weird_pod_bug
Browse files Browse the repository at this point in the history
Fix pod create failure
  • Loading branch information
openshift-merge-robot authored Mar 6, 2019
2 parents ef71475 + b4e184a commit fb14db4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libpod/runtime_pod_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ func (r *Runtime) NewPod(ctx context.Context, options ...PodCreateOption) (*Pod,
if pod.config.UsePodCgroup {
logrus.Debugf("Got pod cgroup as %s", pod.state.CgroupPath)
}
if pod.HasInfraContainer() != pod.SharesNamespaces() {
if !pod.HasInfraContainer() && pod.SharesNamespaces() {
return nil, errors.Errorf("Pods must have an infra container to share namespaces")
}
if pod.HasInfraContainer() && !pod.SharesNamespaces() {
logrus.Warnf("Pod has an infra container, but shares no namespaces")
}

if err := r.state.AddPod(pod); err != nil {
return nil, errors.Wrapf(err, "error adding pod to state")
Expand Down

0 comments on commit fb14db4

Please sign in to comment.