summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/play.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-04-27 13:17:40 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-04-27 13:28:34 +0200
commit70a2c000891ca45c53a39753ad7fb7fde8384812 (patch)
treeadf0fa745aac5370ac8f55ff02100408a057d777 /pkg/domain/infra/abi/play.go
parent053b09660ffbe2df2104186c67e39be70764ff63 (diff)
downloadpodman-70a2c000891ca45c53a39753ad7fb7fde8384812.tar.gz
podman-70a2c000891ca45c53a39753ad7fb7fde8384812.tar.bz2
podman-70a2c000891ca45c53a39753ad7fb7fde8384812.zip
play kube respect hostNetwork
We need to use the host network when it is set in the config and --network was not used. This regression was added in 3e9af2029f1f. Fixes #14015 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi/play.go')
-rw-r--r--pkg/domain/infra/abi/play.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index 45500b23c..5de475480 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -199,18 +199,20 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
return nil, err
}
- ns, networks, netOpts, err := specgen.ParseNetworkFlag(options.Networks)
- if err != nil {
- return nil, err
- }
+ if len(options.Networks) > 0 {
+ ns, networks, netOpts, err := specgen.ParseNetworkFlag(options.Networks)
+ if err != nil {
+ return nil, err
+ }
- if (ns.IsBridge() && len(networks) == 0) || ns.IsHost() {
- return nil, errors.Errorf("invalid value passed to --network: bridge or host networking must be configured in YAML")
- }
+ if (ns.IsBridge() && len(networks) == 0) || ns.IsHost() {
+ return nil, errors.Errorf("invalid value passed to --network: bridge or host networking must be configured in YAML")
+ }
- podOpt.Net.Network = ns
- podOpt.Net.Networks = networks
- podOpt.Net.NetworkOptions = netOpts
+ podOpt.Net.Network = ns
+ podOpt.Net.Networks = networks
+ podOpt.Net.NetworkOptions = netOpts
+ }
// FIXME This is very hard to support properly with a good ux
if len(options.StaticIPs) > *ipIndex {