mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Add IPv6 support to preserve source pod IP test
Co-Authored-By: Benjamin Elder <bentheelder@google.com>
This commit is contained in:
parent
81684586db
commit
48f1756b93
@ -155,7 +155,8 @@ func newEchoServerPodSpec(podName string) *v1.Pod {
|
|||||||
Containers: []v1.Container{
|
Containers: []v1.Container{
|
||||||
{
|
{
|
||||||
Name: "echoserver",
|
Name: "echoserver",
|
||||||
Image: imageutils.GetE2EImage(imageutils.EchoServer),
|
Image: imageutils.GetE2EImage(imageutils.Agnhost),
|
||||||
|
Args: []string{"netexec", fmt.Sprintf("--http-port=%d", port)},
|
||||||
Ports: []v1.ContainerPort{{ContainerPort: int32(port)}},
|
Ports: []v1.ContainerPort{{ContainerPort: int32(port)}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -2321,7 +2321,7 @@ func execSourceipTest(pausePod v1.Pod, serviceAddress string) (string, string) {
|
|||||||
timeout := 2 * time.Minute
|
timeout := 2 * time.Minute
|
||||||
|
|
||||||
e2elog.Logf("Waiting up to %v to get response from %s", timeout, serviceAddress)
|
e2elog.Logf("Waiting up to %v to get response from %s", timeout, serviceAddress)
|
||||||
cmd := fmt.Sprintf(`curl -q -s --connect-timeout 30 %s | grep client_address`, serviceAddress)
|
cmd := fmt.Sprintf(`curl -q -s --connect-timeout 30 %s/clientip`, serviceAddress)
|
||||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(2 * time.Second) {
|
for start := time.Now(); time.Since(start) < timeout; time.Sleep(2 * time.Second) {
|
||||||
stdout, err = framework.RunHostCmd(pausePod.Namespace, pausePod.Name, cmd)
|
stdout, err = framework.RunHostCmd(pausePod.Namespace, pausePod.Name, cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -2338,14 +2338,13 @@ func execSourceipTest(pausePod v1.Pod, serviceAddress string) (string, string) {
|
|||||||
|
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
// The stdout return from RunHostCmd seems to come with "\n", so TrimSpace is needed.
|
// The stdout return from RunHostCmd is in this format: x.x.x.x:port or [xx:xx:xx::x]:port
|
||||||
// Desired stdout in this format: client_address=x.x.x.x
|
host, _, err := net.SplitHostPort(stdout)
|
||||||
outputs := strings.Split(strings.TrimSpace(stdout), "=")
|
if err != nil {
|
||||||
if len(outputs) != 2 {
|
|
||||||
// ginkgo.Fail the test if output format is unexpected.
|
// ginkgo.Fail the test if output format is unexpected.
|
||||||
e2elog.Failf("exec pod returned unexpected stdout format: [%v]\n", stdout)
|
e2elog.Failf("exec pod returned unexpected stdout: [%v]\n", stdout)
|
||||||
}
|
}
|
||||||
return pausePod.Status.PodIP, outputs[1]
|
return pausePod.Status.PodIP, host
|
||||||
}
|
}
|
||||||
|
|
||||||
func execAffinityTestForNonLBServiceWithTransition(f *framework.Framework, cs clientset.Interface, svc *v1.Service) {
|
func execAffinityTestForNonLBServiceWithTransition(f *framework.Framework, cs clientset.Interface, svc *v1.Service) {
|
||||||
|
Loading…
Reference in New Issue
Block a user