mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-07-06 16:37:39 -04:00
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.
|
||
|---|---|---|
| .. | ||
| .import-restrictions | ||
| utils.go | ||