diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-12-23 21:35:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-23 21:35:34 +0100 |
commit | 61a2262e398125b2bea2a85a7e53256b08558152 (patch) | |
tree | 54d571a74f7d3f3aa64a8932ec01b555f971cb0b /pkg/specgen | |
parent | 3d21da3d11dc9b5944912544609c302c86e56b97 (diff) | |
parent | 14439b986924dd64c465e2f0df12f74e7334298e (diff) | |
download | podman-61a2262e398125b2bea2a85a7e53256b08558152.tar.gz podman-61a2262e398125b2bea2a85a7e53256b08558152.tar.bz2 podman-61a2262e398125b2bea2a85a7e53256b08558152.zip |
Merge pull request #8792 from bziemons/patch-host-network-spec-8790
Set NetNS mode instead of value
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/kube/kube.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go index fe0af3509..b5956029e 100644 --- a/pkg/specgen/generate/kube/kube.go +++ b/pkg/specgen/generate/kube/kube.go @@ -30,7 +30,7 @@ func ToPodGen(ctx context.Context, podName string, podYAML *v1.PodTemplateSpec) p.Hostname = podName } if podYAML.Spec.HostNetwork { - p.NetNS.Value = "host" + p.NetNS.NSMode = specgen.Host } if podYAML.Spec.HostAliases != nil { hosts := make([]string, 0, len(podYAML.Spec.HostAliases)) @@ -47,7 +47,7 @@ func ToPodGen(ctx context.Context, podName string, podYAML *v1.PodTemplateSpec) return p, nil } -func ToSpecGen(ctx context.Context, containerYAML v1.Container, iid string, newImage *image.Image, volumes map[string]*KubeVolume, podID, podName, infraID string, configMaps []v1.ConfigMap, seccompPaths *KubeSeccompPaths, restartPolicy string) (*specgen.SpecGenerator, error) { +func ToSpecGen(ctx context.Context, containerYAML v1.Container, iid string, newImage *image.Image, volumes map[string]*KubeVolume, podID, podName, infraID string, configMaps []v1.ConfigMap, seccompPaths *KubeSeccompPaths, restartPolicy string, hostNet bool) (*specgen.SpecGenerator, error) { s := specgen.NewSpecGenerator(iid, false) // podName should be non-empty for Deployment objects to be able to create @@ -214,6 +214,10 @@ func ToSpecGen(ctx context.Context, containerYAML v1.Container, iid string, newI s.RestartPolicy = restartPolicy + if hostNet { + s.NetNS.NSMode = specgen.Host + } + return s, nil } |