aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/backend_lookup.go4
-rw-r--r--plugin/k8s_external/msg_to_dns.go4
-rw-r--r--plugin/kubernetes/xfr.go7
3 files changed, 14 insertions, 1 deletions
diff --git a/plugin/backend_lookup.go b/plugin/backend_lookup.go
index c563295d6..9d7e366a3 100644
--- a/plugin/backend_lookup.go
+++ b/plugin/backend_lookup.go
@@ -185,6 +185,10 @@ func SRV(ctx context.Context, b ServiceBackend, zone string, state request.Reque
w1 *= float64(serv.Weight)
}
weight := uint16(math.Floor(w1))
+ // weight should be at least 1
+ if weight == 0 {
+ weight = 1
+ }
what, ip := serv.HostType()
diff --git a/plugin/k8s_external/msg_to_dns.go b/plugin/k8s_external/msg_to_dns.go
index 14a198063..e61adf657 100644
--- a/plugin/k8s_external/msg_to_dns.go
+++ b/plugin/k8s_external/msg_to_dns.go
@@ -103,6 +103,10 @@ func (e *External) srv(services []msg.Service, state request.Request) (records,
w1 *= float64(s.Weight)
}
weight := uint16(math.Floor(w1))
+ // weight should be at least 1
+ if weight == 0 {
+ weight = 1
+ }
what, ip := s.HostType()
diff --git a/plugin/kubernetes/xfr.go b/plugin/kubernetes/xfr.go
index 7759c5a47..a3a0d4a4a 100644
--- a/plugin/kubernetes/xfr.go
+++ b/plugin/kubernetes/xfr.go
@@ -228,6 +228,11 @@ func calcSRVWeight(numservices int) uint16 {
}
w[serv.Priority] += weight
}
+ weight := uint16(math.Floor((100.0 / float64(w[0])) * 100))
+ // weight should be at least 1
+ if weight == 0 {
+ weight = 1
+ }
- return uint16(math.Floor((100.0 / float64(w[0])) * 100))
+ return weight
}