diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-05-08 20:02:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-08 20:02:42 +0200 |
commit | b2e8915baa22098fbde39b73ad0f18326ec2842b (patch) | |
tree | 46602b322a8a10d1697d8f6c14027db3109c9164 /pkg/specgen/generate | |
parent | 428246d4e48a5b3ac1c499fed8d82276195a4ec9 (diff) | |
parent | 7989e422b404c2fe182dac5154fbfe218c561b93 (diff) | |
download | podman-b2e8915baa22098fbde39b73ad0f18326ec2842b.tar.gz podman-b2e8915baa22098fbde39b73ad0f18326ec2842b.tar.bz2 podman-b2e8915baa22098fbde39b73ad0f18326ec2842b.zip |
Merge pull request #6144 from mheon/fix_pod_create_noinfra
Fix `podman pod create --infra=false`
Diffstat (limited to 'pkg/specgen/generate')
-rw-r--r-- | pkg/specgen/generate/pod_create.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go index df5775f8b..cd2d69cfb 100644 --- a/pkg/specgen/generate/pod_create.go +++ b/pkg/specgen/generate/pod_create.go @@ -5,6 +5,7 @@ import ( "github.com/containers/libpod/libpod" "github.com/containers/libpod/pkg/specgen" + "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -68,15 +69,17 @@ func createPodOptions(p *specgen.PodSpecGenerator) ([]libpod.PodCreateOption, er if p.NoManageResolvConf { options = append(options, libpod.WithPodUseImageResolvConf()) } + if len(p.CNINetworks) > 0 { + options = append(options, libpod.WithPodNetworks(p.CNINetworks)) + } switch p.NetNS.NSMode { - case specgen.Bridge: + case specgen.Bridge, specgen.Default, "": logrus.Debugf("Pod using default network mode") case specgen.Host: logrus.Debugf("Pod will use host networking") options = append(options, libpod.WithPodHostNetwork()) default: - logrus.Debugf("Pod joining CNI networks: %v", p.CNINetworks) - options = append(options, libpod.WithPodNetworks(p.CNINetworks)) + return nil, errors.Errorf("pods presently do not support network mode %s", p.NetNS.NSMode) } if p.NoManageHosts { |