Change:
}) framework.ExpectNoError(err) <del> ginkgo.By("waiting for the no-snat-test-proxy Pod to be scheduled and running") err = wait.PollImmediate(10*time.Second, 1*time.Minute, func() (bool, error) { pod, err := pc.Get(context.TODO(), "no-snat-test-proxy", metav1.GetOptions{}) if err != nil { return false, err } if pod.Status.Phase != v1.PodRunning { if pod.Status.Phase != v1.PodPending { return false, fmt.Errorf("expected pod to be in phase "Pending" or "Running"") } return false, nil // pod is still pending } return true, nil // pod is running }) framework.ExpectNoError(err) </del> ginkgo.By("sending traffic from each pod to the others and checking that SNAT does not occur") <del> pods, err := pc.List(context.TODO(), metav1.ListOptions{LabelSelector: "no-snat-test"}) </del> <ins> pods, err := pc.List(context.TODO(), metav1.ListOptions{LabelSelector: noSNATTestName}) </ins> framework.ExpectNoError(err) <del> // collect pod IPs podIPs := []string{} for _, pod := range pods.Items { podIPs = append(podIPs, pod.Status.PodIP+":"+strconv.Itoa(testPodPort)) } // hit the /checknosnat endpoint on each Pod, tell each Pod to check all the other Pods </del> <ins> // hit the /clientip endpoint on every other Pods to check if source ip is preserved </ins> // this test is O(n^2) but it doesn't matter because we only run this test on small clusters (~3 nodes) <del> errs := []string{} client := http.Client{ Timeout: 5 * time.Minute, } for _, pip := range podIPs { ips := []string{} for _, ip := range podIPs { if ip == pip { </del> <ins> for _, sourcePod := range pods.Items { for _, targetPod := range pods.Items { if targetPod.Name == sourcePod.Name { </ins> continue } <del> ips = append(ips, ip) </del> <ins> targetAddr := net.JoinHostPort(targetPod.Status.PodIP, testPodPort) sourceIP, execPodIP := execSourceIPTest(sourcePod, targetAddr) ginkgo.By("Verifying the preserved source ip") framework.ExpectEqual(sourceIP, execPodIP) </ins> } <del> // hit /checknosnat on pip, via proxy resp, err := client.Get(checknosnatURL(proxyNodeIP, pip, ips)) framework.ExpectNoError(err) // check error code on the response, if 500 record the body, which will describe the error if resp.StatusCode == 500 { body, err := ioutil.ReadAll(resp.Body) framework.ExpectNoError(err) errs = append(errs, string(body)) } resp.Body.Close() } // report the errors all at the end if len(errs) > 0 { str := strings.Join(errs, "n") err := fmt.Errorf("/checknosnat failed in the following cases:n%s", str) framework.ExpectNoError(err) </del> } }) })

Discussion:
What would you like to be : The test currently only works on Cloud Providers or environments that set the External IP on nodes, because it is using the framework directly to check the IPs of the pods, using a no-snat-test-proxy to check if the Pods are not using SNAT. However, this can be simplified, removing the no-snat-test-proxy Pod and executing the queries directly in a Pod. Why is this needed: The test should work in all environments, and it's failing https://k8s-,%20master&include-filter-by-regex=NoSNAT
/sig network /help wanted /failing test
/remove kind-feature /kind failing-test
/help
This request has been marked as needing help from a contributor. Please ensure the request meets the requirements listed . If this request no longer meets these requirements, the label can be removed by commenting with the command. <detailsIn response to : /help Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/remove kind-feature
/triage unresolved Comment when the issue is assessed and confirmed. I am a bot run by vllry. ‍
I would like to investigate this problem. /assign
I have filed , how could I verify if my patch fixes the problem?
I run them locally with KIND