]> go.fuhry.dev Git - runtime.git/commit
hostname: support /etc/hosts, /etc/resolv.conf; add container detection
authorDan Fuhry <dan@fuhry.com>
Fri, 25 Oct 2024 15:34:43 +0000 (11:34 -0400)
committerDan Fuhry <dan@fuhry.com>
Fri, 25 Oct 2024 15:42:44 +0000 (11:42 -0400)
commitc039df3457a8d9c2b2bcfd6406ee0f9a414ee53e
tree8490d607ac6f7b7c1eb3b2691111fe5632aeb139
parent4e02390933d01cb82929b20b0505e8fbbb5ac006
hostname: support /etc/hosts, /etc/resolv.conf; add container detection

Needed for Kubernetes compatibility.

Kubernetes doesn't publish DNS records for pods. So the runtime can no longer assume that A/AAAA records exist for the host.

As a first step we need to be able to detect the hostname and kubernetes domain name. K8s is pretty good about populating `/etc/hosts` and `/etc/resolv.conf`, so we parse those when k8s is detected.
go.mod
go.sum
net/dns/dns_cache.go
net/dns/hosts.go [new file with mode: 0644]
utils/hostname/hostname_common.go [new file with mode: 0644]
utils/hostname/hostname_generic.go
utils/hostname/hostname_linux.go