Skip to content

Commit

Permalink
Merge pull request openshift#210 from alexanderConstantinescu/4.6-dns
Browse files Browse the repository at this point in the history
Bug 1891454: Fix error handling from DNS nameservers
  • Loading branch information
openshift-merge-robot committed Dec 12, 2020
2 parents 2866fd4 + c28d4c8 commit adcf1b2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/network/common/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/klog"
)

const (
Expand Down Expand Up @@ -139,10 +140,12 @@ func (d *DNS) getIPsAndMinTTL(domain string) ([]net.IP, time.Duration, error) {
c.Timeout = 5 * time.Second
in, _, err := c.Exchange(msg, dialServer)
if err != nil {
return nil, defaultTTL, err
klog.Warningf("failed to query nameserver: %s with address: %s for domain: %s, err: %v", server, dialServer, domain, err)
continue
}
if in != nil && in.Rcode != dns.RcodeSuccess {
return nil, defaultTTL, fmt.Errorf("failed to get a valid answer: %v", in)
klog.Warningf("failed to get a valid answer: %v from nameserver: %s for domain: %s", in.Rcode, server, domain)
continue
}

if in != nil && len(in.Answer) > 0 {
Expand Down

0 comments on commit adcf1b2

Please sign in to comment.