mirror of https://github.com/status-im/consul.git
feat(v2dns): enable peering queries (#20581)
This commit is contained in:
parent
ec76090be9
commit
5802080db1
|
@ -99,6 +99,11 @@ func (f *V1DataFetcher) LoadConfig(config *config.RuntimeConfig) {
|
|||
|
||||
// FetchNodes fetches A/AAAA/CNAME
|
||||
func (f *V1DataFetcher) FetchNodes(ctx Context, req *QueryPayload) ([]*Result, error) {
|
||||
if req.Tenancy.Namespace != "" && req.Tenancy.Namespace != acl.DefaultNamespaceName {
|
||||
// Nodes are not namespaced, so this is a name error
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
cfg := f.dynamicConfig.Load().(*v1DataFetcherDynamicConfig)
|
||||
// Make an RPC request
|
||||
args := &structs.NodeSpecificRequest{
|
||||
|
@ -430,6 +435,7 @@ func (f *V1DataFetcher) buildResultsFromServiceNodes(nodes []structs.CheckServic
|
|||
Namespace: n.Service.NamespaceOrEmpty(),
|
||||
Partition: n.Service.PartitionOrEmpty(),
|
||||
Datacenter: n.Node.Datacenter,
|
||||
PeerName: req.Tenancy.Peer,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -156,6 +156,9 @@ func Test_FetchEndpoints(t *testing.T) {
|
|||
Number: 0,
|
||||
},
|
||||
},
|
||||
Tenancy: ResultTenancy{
|
||||
PeerName: "test-peer",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,9 @@ func (f *V2DataFetcher) LoadConfig(config *config.RuntimeConfig) {
|
|||
|
||||
// FetchNodes fetches A/AAAA/CNAME
|
||||
func (f *V2DataFetcher) FetchNodes(ctx Context, req *QueryPayload) ([]*Result, error) {
|
||||
return nil, nil
|
||||
// TODO (v2-dns): NET-6623 - Implement FetchNodes
|
||||
// Make sure that we validate that namespace is not provided here
|
||||
return nil, fmt.Errorf("not implemented")
|
||||
}
|
||||
|
||||
// FetchEndpoints fetches records for A/AAAA/CNAME or SRV requests for services
|
||||
|
@ -137,13 +139,15 @@ func (f *V2DataFetcher) FetchEndpoints(reqContext Context, req *QueryPayload, lo
|
|||
|
||||
// FetchVirtualIP fetches A/AAAA records for virtual IPs
|
||||
func (f *V2DataFetcher) FetchVirtualIP(ctx Context, req *QueryPayload) (*Result, error) {
|
||||
return nil, nil
|
||||
// TODO (v2-dns): NET-6624 - Implement FetchVirtualIP
|
||||
return nil, fmt.Errorf("not implemented")
|
||||
}
|
||||
|
||||
// FetchRecordsByIp is used for PTR requests to look up a service/node from an IP.
|
||||
// TODO (v2-dns): Validate non-nil IP
|
||||
func (f *V2DataFetcher) FetchRecordsByIp(ctx Context, ip net.IP) ([]*Result, error) {
|
||||
return nil, nil
|
||||
// TODO (v2-dns): NET-6795 - Implement FetchRecordsByIp
|
||||
// Validate non-nil IP
|
||||
return nil, fmt.Errorf("not implemented")
|
||||
}
|
||||
|
||||
// FetchWorkload is used to fetch a single workload from the V2 catalog.
|
||||
|
|
|
@ -17,13 +17,12 @@ import (
|
|||
"github.com/hashicorp/consul/testrpc"
|
||||
)
|
||||
|
||||
// TODO(v2-dns): NET-7910 - Fix ENT and CE variants of DNS v1 compatibility tests
|
||||
func TestDNS_CE_PeeredServices(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("too slow for testing.Short")
|
||||
}
|
||||
|
||||
for name, experimentsHCL := range getVersionHCL(false) {
|
||||
for name, experimentsHCL := range getVersionHCL(true) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
a := StartTestAgent(t, TestAgent{HCL: ``, Overrides: `peering = { test_allow_peer_registrations = true } ` + experimentsHCL})
|
||||
defer a.Shutdown()
|
||||
|
|
Loading…
Reference in New Issue