aboutsummaryrefslogtreecommitdiff
path: root/plugin/backend_lookup.go
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2018-08-27 10:10:51 -0400
committerGravatar GitHub <noreply@github.com> 2018-08-27 10:10:51 -0400
commitd60993e0210cba3576fa0bfa158a23e8abab6f80 (patch)
tree85bb291a2e4cd2d43190466f9c2c517232be16ed /plugin/backend_lookup.go
parent75f1b9c988e036a56f0ae31224401aa9b652e9ef (diff)
downloadcoredns-d60993e0210cba3576fa0bfa158a23e8abab6f80.tar.gz
coredns-d60993e0210cba3576fa0bfa158a23e8abab6f80.tar.zst
coredns-d60993e0210cba3576fa0bfa158a23e8abab6f80.zip
plugin/kubernetes: Create records for portless services (#2052)
inject sentinels for portless services
Diffstat (limited to 'plugin/backend_lookup.go')
-rw-r--r--plugin/backend_lookup.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugin/backend_lookup.go b/plugin/backend_lookup.go
index 002d1855b..65cdcbaf5 100644
--- a/plugin/backend_lookup.go
+++ b/plugin/backend_lookup.go
@@ -172,6 +172,11 @@ func SRV(b ServiceBackend, zone string, state request.Request, opt Options) (rec
w[serv.Priority] += weight
}
for _, serv := range services {
+ // Don't add the entry if the port is -1 (invalid). The kubernetes plugin uses port -1 when a service/endpoint
+ // does not have any declared ports.
+ if serv.Port == -1 {
+ continue
+ }
w1 := 100.0 / float64(w[serv.Priority])
if serv.Weight == 0 {
w1 *= 100