mirror of https://github.com/hashicorp/consul
feat(v2dns): support 'cluster' label
parent
08c48a7381
commit
323858b3ca
|
@ -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]
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue