mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #43898 from wojtek-t/debug_preserve_source_pod_ip
Automatic merge from submit-queue Debug problems encountered in #43702
This commit is contained in:
commit
503c9e581a
@ -346,6 +346,35 @@ func NodeOSDistroIs(supportedNodeOsDistros ...string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func ProxyMode(f *Framework) (string, error) {
|
||||
pod := &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "kube-proxy-mode-detector",
|
||||
Namespace: f.Namespace.Name,
|
||||
},
|
||||
Spec: v1.PodSpec{
|
||||
HostNetwork: true,
|
||||
Containers: []v1.Container{
|
||||
{
|
||||
Name: "detector",
|
||||
Image: "gcr.io/google_containers/e2e-net-amd64:1.0",
|
||||
Command: []string{"/bin/sleep", "3600"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
f.PodClient().CreateSync(pod)
|
||||
defer f.PodClient().DeleteSync(pod.Name, &metav1.DeleteOptions{}, time.Minute)
|
||||
|
||||
cmd := "curl -q -s --connect-timeout 1 http://localhost:10249/proxyMode"
|
||||
stdout, err := RunHostCmd(pod.Namespace, pod.Name, cmd)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
Logf("ProxyMode: %s", stdout)
|
||||
return stdout, nil
|
||||
}
|
||||
|
||||
func SkipUnlessServerVersionGTE(v *utilversion.Version, c discovery.ServerVersionInterface) {
|
||||
gte, err := ServerVersionGTE(v, c)
|
||||
if err != nil {
|
||||
|
@ -216,6 +216,16 @@ var _ = framework.KubeDescribe("Services", func() {
|
||||
|
||||
It("should preserve source pod IP for traffic thru service cluster IP", func() {
|
||||
|
||||
// This behavior is not supported if Kube-proxy is in "userspace" mode.
|
||||
// So we check the kube-proxy mode and skip this test if that's the case.
|
||||
if proxyMode, err := framework.ProxyMode(f); err == nil {
|
||||
if proxyMode == "userspace" {
|
||||
framework.Skipf("The test doesn't work with kube-proxy in userspace mode")
|
||||
}
|
||||
} else {
|
||||
framework.Logf("Couldn't detect KubeProxy mode - test failure may be expected: %v", err)
|
||||
}
|
||||
|
||||
serviceName := "sourceip-test"
|
||||
ns := f.Namespace.Name
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user