mirror of
https://github.com/containers/podman.git
synced 2025-06-10 09:47:25 +08:00
Merge pull request #14029 from Luap99/kube-hostnet
play kube respect hostNetwork
This commit is contained in:
@ -199,6 +199,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(options.Networks) > 0 {
|
||||||
ns, networks, netOpts, err := specgen.ParseNetworkFlag(options.Networks)
|
ns, networks, netOpts, err := specgen.ParseNetworkFlag(options.Networks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -211,6 +212,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
|
|||||||
podOpt.Net.Network = ns
|
podOpt.Net.Network = ns
|
||||||
podOpt.Net.Networks = networks
|
podOpt.Net.Networks = networks
|
||||||
podOpt.Net.NetworkOptions = netOpts
|
podOpt.Net.NetworkOptions = netOpts
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME This is very hard to support properly with a good ux
|
// FIXME This is very hard to support properly with a good ux
|
||||||
if len(options.StaticIPs) > *ipIndex {
|
if len(options.StaticIPs) > *ipIndex {
|
||||||
|
@ -2779,11 +2779,7 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman play kube test with HostNetwork", func() {
|
It("podman play kube test with HostNetwork", func() {
|
||||||
if !strings.Contains(podmanTest.OCIRuntime, "crun") {
|
pod := getPod(withHostNetwork(), withCtr(getCtr(withCmd([]string{"readlink", "/proc/self/ns/net"}), withArg(nil))))
|
||||||
Skip("Test only works on crun")
|
|
||||||
}
|
|
||||||
|
|
||||||
pod := getPod(withHostNetwork())
|
|
||||||
err := generateKubeYaml("pod", pod, kubeYaml)
|
err := generateKubeYaml("pod", pod, kubeYaml)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
|
|
||||||
@ -2795,6 +2791,17 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
|
|||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
Expect(inspect.OutputToString()).To(Equal("true"))
|
Expect(inspect.OutputToString()).To(Equal("true"))
|
||||||
|
|
||||||
|
ns := SystemExec("readlink", []string{"/proc/self/ns/net"})
|
||||||
|
ns.WaitWithDefaultTimeout()
|
||||||
|
Expect(ns).Should(Exit(0))
|
||||||
|
netns := ns.OutputToString()
|
||||||
|
Expect(netns).ToNot(BeEmpty())
|
||||||
|
|
||||||
|
logs := podmanTest.Podman([]string{"logs", getCtrNameInPod(pod)})
|
||||||
|
logs.WaitWithDefaultTimeout()
|
||||||
|
Expect(logs).Should(Exit(0))
|
||||||
|
Expect(logs.OutputToString()).To(Equal(netns))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman play kube persistentVolumeClaim", func() {
|
It("podman play kube persistentVolumeClaim", func() {
|
||||||
|
Reference in New Issue
Block a user