diff options
author | 2020-06-12 14:01:28 +0800 | |
---|---|---|
committer | 2020-06-12 06:01:28 +0000 | |
commit | 4734c0db458550484486609cf1d2f22f7933349c (patch) | |
tree | 33c783f7569b294d985990c26592a70f3f86c9dc /plugin/kubernetes/xfr.go | |
parent | 86df1282cb0a390a96b7960b7c43db8429c98003 (diff) | |
download | coredns-4734c0db458550484486609cf1d2f22f7933349c.tar.gz coredns-4734c0db458550484486609cf1d2f22f7933349c.tar.zst coredns-4734c0db458550484486609cf1d2f22f7933349c.zip |
weight for SRV records should be at least 1 (#3931)
Automatically submitted.
Diffstat (limited to 'plugin/kubernetes/xfr.go')
-rw-r--r-- | plugin/kubernetes/xfr.go | 7 |
1 files changed, 6 insertions, 1 deletions
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 } |