Skip to content

Commit f54fc8a

Browse files
committed
fix parsing resolv.conf when systemd-resolved is running on the host (kubeovn#5423)
Signed-off-by: zhangzujian <[email protected]>
1 parent 78fb865 commit f54fc8a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/daemon/exporter_metric.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (c *Controller) setCniConfigMetric() {
8080
}
8181

8282
func (c *Controller) setDNSSearchMetric() {
83-
file, err := resolvconf.Get()
83+
file, err := resolvconf.GetSpecific("/etc/resolv.conf")
8484
if err != nil {
8585
klog.Errorf("failed to get /etc/resolv.conf content: %v", err)
8686
return
@@ -89,7 +89,8 @@ func (c *Controller) setDNSSearchMetric() {
8989

9090
found := false
9191
for _, domain := range domains {
92-
if strings.Contains(domain, "local") {
92+
if domain == "." {
93+
// Ignore the root domain
9394
continue
9495
}
9596

0 commit comments

Comments
 (0)