Files
coredns/plugin/traffic/HACKING.md
Miek Gieben d21efd17cb update hacking text
Signed-off-by: Miek Gieben <miek@miek.nl>
2020-01-17 17:24:35 +01:00

1.8 KiB

Hacking on traffic

Repos used:

https://github.com/envoyproxy/go-control-plane
implements control plane, has testing stuff in pkg/test/main (iirc).
https://github.com/grpc/grpc-go/tree/master/xds/internal/client
implements client for xDS - much of this code has been reused here.

I found these website useful while working on this.

Testing

Assuming you have envoyproxy/go-control-plane checked out somewhere, then:

% cd ~/src/github.com/envoyproxy/go-control-plane/pkg/test/main
% go build
% ./main --xds=ads --runtimes=2 -debug

This runs a binary from pkg/test/main. Now we're testing aDS. Everything is using gRPC with TLS disabled: grpc.WithInsecure(). The test binary runs on port 18000 on localhost; all these things are currently hardcoded in the traffic plugin. This will be factored out into config as some point. Another thing that is hardcoded is the use of the "example.org" domain.

Then for CoreDNS, check out the traffic branch, create a Corefile:

example.org {
    traffic grpc://127.0.0.1:18000 {
        id test-id
    }
    debug
}

Start CoreDNS (coredns -conf Corefile -dns.port=1053), and see logging/debugging flow by; the test binary should also spew out a bunch of things. CoreDNS willl build up a list of cluster and endpoints. Next you can query it. Note none of the endpoints are HEALTHY so you'll mostly get NODATA responses, instead of actual records.

Note: the xds/test binary is a go-control-plane binary with added debugging that I'm using for testing.