bring back minor DNS cache for k8s setups (#19341)

k8s as it stands is flaky in DNS lookups,
bring this change back such that we can
cache DNS atleast for 30secs TTL.
This commit is contained in:
Harshavardhana
2024-03-26 08:00:38 -07:00
committed by GitHub
parent 4b9192034c
commit dc45a5010d
6 changed files with 28 additions and 76 deletions

View File

@@ -98,12 +98,7 @@ func mustGetLocalIP6() (ipList set.StringSet) {
// getHostIP returns IP address of given host.
func getHostIP(host string) (ipList set.StringSet, err error) {
lookupHost := globalDNSCache.LookupHost
if IsKubernetes() || IsDocker() {
lookupHost = net.DefaultResolver.LookupHost
}
addrs, err := lookupHost(GlobalContext, host)
addrs, err := globalDNSCache.LookupHost(GlobalContext, host)
if err != nil {
return ipList, err
}