kubernetes/test/e2e/framework/network
Jitesh Kumar f0310b5ce8 test/e2e/network: fix hostNetwork tests broken by --hostname-override
os.Hostname() on a hostNetwork pod diverges from spec.nodeName on clusters
that set --hostname-override (DigitalOcean/kops uses the droplet IP; some
AWS/kops setups use the EC2 instance ID). Tests comparing /hostname output
against node.Name have been flaking on those providers since the hostNetwork
test cases were added.

Use the Downward API instead: inject NODE_NAME=spec.nodeName into hostNetwork
endpoint pods and read it back via agnhost's /envvar?var=NODE_NAME endpoint,
available since agnhost:2.65.0.

For UDP/SCTP, the dial relay sends the request value as raw bytes; the HTTP
query-string form cannot be reused. echoNodenameUDP ("envvar%20NODE_NAME")
percent-encodes the space so url.ParseQuery at the relay decodes it to the
space-separated form the UDP handler expects.

Non-hostNetwork paths are unchanged.
2026-06-21 12:46:47 +05:30
..
.import-restrictions e2e framework: remove dependency on k8s.io/kubernetes/pkg/api/v1/pod 2023-05-12 08:39:37 +08:00
utils.go test/e2e/network: fix hostNetwork tests broken by --hostname-override 2026-06-21 12:46:47 +05:30