plugin/k8s_external: Fix rcode for headless services (#5657)
Signed-off-by: Miciah Masters <miciah.masters@gmail.com> Signed-off-by: Miciah Masters <miciah.masters@gmail.com>
This commit is contained in:
parent
4e449b666a
commit
6cb5e10707
2 changed files with 6 additions and 6 deletions
|
@ -116,6 +116,7 @@ func (k *Kubernetes) External(state request.Request, headless bool) ([]msg.Servi
|
||||||
if !(matchPortAndProtocol(port, p.Name, protocol, p.Protocol)) {
|
if !(matchPortAndProtocol(port, p.Name, protocol, p.Protocol)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
rcode = dns.RcodeSuccess
|
||||||
s := msg.Service{Host: addr.IP, Port: int(p.Port), TTL: k.ttl}
|
s := msg.Service{Host: addr.IP, Port: int(p.Port), TTL: k.ttl}
|
||||||
s.Key = strings.Join([]string{zonePath, svc.Namespace, svc.Name, endpointHostname(addr, k.endpointNameMode)}, "/")
|
s.Key = strings.Join([]string{zonePath, svc.Namespace, svc.Name, endpointHostname(addr, k.endpointNameMode)}, "/")
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ var extCases = []struct {
|
||||||
{
|
{
|
||||||
Qname: "svc6.testns.example.org.", Rcode: dns.RcodeSuccess,
|
Qname: "svc6.testns.example.org.", Rcode: dns.RcodeSuccess,
|
||||||
Msg: []msg.Service{
|
Msg: []msg.Service{
|
||||||
{Host: "1:2::5", Port: 80, TTL: 5, Key: "/c/org/example/testns/svc1"},
|
{Host: "1:2::5", Port: 80, TTL: 5, Key: "/c/org/example/testns/svc6"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -46,14 +46,14 @@ var extCases = []struct {
|
||||||
{
|
{
|
||||||
Qname: "svc-headless.testns.example.com.", Rcode: dns.RcodeSuccess,
|
Qname: "svc-headless.testns.example.com.", Rcode: dns.RcodeSuccess,
|
||||||
Msg: []msg.Service{
|
Msg: []msg.Service{
|
||||||
{Host: "1.2.3.4", Port: 80, TTL: 5, Weight: 50, Key: "/c/org/example/testns/svc-headless"},
|
{Host: "1.2.3.4", Port: 80, TTL: 5, Weight: 50, Key: "/c/org/example/testns/svc-headless/endpoint-svc-0"},
|
||||||
{Host: "1.2.3.5", Port: 80, TTL: 5, Weight: 50, Key: "/c/org/example/testns/svc-headless"},
|
{Host: "1.2.3.5", Port: 80, TTL: 5, Weight: 50, Key: "/c/org/example/testns/svc-headless/endpoint-svc-1"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Qname: "endpoint-0.svc-headless.testns.example.com.", Rcode: dns.RcodeSuccess,
|
Qname: "endpoint-svc-0.svc-headless.testns.example.com.", Rcode: dns.RcodeSuccess,
|
||||||
Msg: []msg.Service{
|
Msg: []msg.Service{
|
||||||
{Host: "1.2.3.4", Port: 80, TTL: 5, Weight: 100, Key: "/c/org/example/testns/svc-headless/endpoint-0"},
|
{Host: "1.2.3.4", Port: 80, TTL: 5, Weight: 100, Key: "/c/org/example/testns/svc-headless/endpoint-svc-0"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,6 @@ func TestExternal(t *testing.T) {
|
||||||
if x := tc.Msg[j].Key; x != s.Key {
|
if x := tc.Msg[j].Key; x != s.Key {
|
||||||
t.Errorf("Test %d, expected key %s, got %s", i, x, s.Key)
|
t.Errorf("Test %d, expected key %s, got %s", i, x, s.Key)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue