From 494227d95fdf05035859c0536a12c52774e1be79 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Mon, 30 Mar 2020 14:54:04 +0200 Subject: [PATCH] Name things slightly better Signed-off-by: Miek Gieben --- plugin/traffic/grpc_lb.go | 16 ++++++++++++++++ plugin/traffic/lb.go | 17 ----------------- plugin/traffic/setup_test.go | 2 +- 3 files changed, 17 insertions(+), 18 deletions(-) create mode 100644 plugin/traffic/grpc_lb.go delete mode 100644 plugin/traffic/lb.go diff --git a/plugin/traffic/grpc_lb.go b/plugin/traffic/grpc_lb.go new file mode 100644 index 000000000..7205caea3 --- /dev/null +++ b/plugin/traffic/grpc_lb.go @@ -0,0 +1,16 @@ +package traffic + +import ( + "github.com/miekg/dns" +) + +// See https://github.com/grpc/grpc/blob/master/doc/service_config.md for the fields in this proto. +// We encode it as json and return it in a TXT field. +var lbTXT = `grpc_config=[{"serviceConfig":{"loadBalancingConfig":[{"eds_experimental":{"LrsLoadReportingServerName":"","Cluster": "xds"}}]}}]` + +func txt(z string) []dns.RR { + return []dns.RR{&dns.TXT{ + Hdr: dns.RR_Header{Name: z, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: 5}, + Txt: []string{lbTXT}, + }} +} diff --git a/plugin/traffic/lb.go b/plugin/traffic/lb.go deleted file mode 100644 index 5bff77f37..000000000 --- a/plugin/traffic/lb.go +++ /dev/null @@ -1,17 +0,0 @@ -package traffic - -import "github.com/miekg/dns" - -// See https://github.com/grpc/grpc/blob/master/doc/service_config.md for the fields in this proto. -// We encode it as json and return it in a TXT field. -var lbTXTxds = `grpc_config=[{"serviceConfig":{"loadBalancingConfig":[{"xds_experimental":{"lrs_load_reporting_server_name":""}}]}}]` - -// Current impl. that will be removed in favor of xds -var lbTXTgrpc = `grpc_config=[{"serviceConfig":{"loadBalancingConfig":[{"grpclb":{}}]}}]` - -func txt(z string) []dns.RR { - return []dns.RR{&dns.TXT{ - Hdr: dns.RR_Header{Name: z, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: 5}, - Txt: []string{lbTXTgrpc}, - }} -} diff --git a/plugin/traffic/setup_test.go b/plugin/traffic/setup_test.go index a14e49ff6..b8a9b7042 100644 --- a/plugin/traffic/setup_test.go +++ b/plugin/traffic/setup_test.go @@ -15,7 +15,7 @@ func TestSetup(t *testing.T) { } func TestLBTxt(t *testing.T) { - for _, txt := range []string{lbTXTxds, lbTXTgrpc} { + for _, txt := range []string{lbTXT} { if _, err := json.Marshal(txt); err != nil { t.Errorf("Failed to marshal grpc serverConfig: %s", err) }