feat(v2dns): support 'cluster' label

pull/20640/head
DanStough 2024-02-14 11:53:26 -05:00
parent 08c48a7381
commit 323858b3ca
No known key found for this signature in database
GPG Key ID: 0D994ED7D73D7809
2 changed files with 5 additions and 4 deletions

View File

@ -33,7 +33,7 @@ func parseLabels(labels []string) (*parsedLabels, bool) {
result.Namespace = labels[i]
case "ap":
result.Partition = labels[i]
case "dc": // TODO (v2-dns): This should also include "cluster" for the new notation.
case "dc", "cluster":
result.Datacenter = labels[i]
case "sg":
result.SamenessGroup = labels[i]

View File

@ -2983,7 +2983,7 @@ func Test_HandleRequest(t *testing.T) {
},
Question: []dns.Question{
{
Name: "foo.query.consul.",
Name: "foo.query.dc1.cluster.consul.",
Qtype: dns.TypeA,
Qclass: dns.ClassINET,
},
@ -3024,6 +3024,7 @@ func Test_HandleRequest(t *testing.T) {
Run(func(args mock.Arguments) {
req := args.Get(1).(*discovery.QueryPayload)
require.Equal(t, "foo", req.Name)
require.Equal(t, "dc1", req.Tenancy.Datacenter)
})
},
validateAndNormalizeExpected: true,
@ -3036,7 +3037,7 @@ func Test_HandleRequest(t *testing.T) {
Compress: true,
Question: []dns.Question{
{
Name: "foo.query.consul.",
Name: "foo.query.dc1.cluster.consul.",
Qtype: dns.TypeA,
Qclass: dns.ClassINET,
},
@ -3044,7 +3045,7 @@ func Test_HandleRequest(t *testing.T) {
Answer: []dns.RR{
&dns.A{
Hdr: dns.RR_Header{
Name: "foo.query.consul.",
Name: "foo.query.dc1.cluster.consul.",
Rrtype: dns.TypeA,
Class: dns.ClassINET,
Ttl: 1,