Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update from update/networkservicemesh/sdk-vpp #72

Merged
merged 2 commits into from
Jun 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,18 +316,7 @@ func main() {
close(subscribedChannels[0])
}

nseStream, err := nseRegistryClient.Find(ctx, &registryapi.NetworkServiceEndpointQuery{
NetworkServiceEndpoint: &registryapi.NetworkServiceEndpoint{
NetworkServiceNames: config.ServiceNames,
},
})

if err != nil {
log.FromContext(ctx).Fatalf("error getting nses: %+v", err)
}
nseList := registryapi.ReadNetworkServiceEndpointList(nseStream)

var initialDNSFanoutList = make([]url.URL, len(nseList))
var initialDNSFanoutList = make([]url.URL, 0, 32)

server := createVl3Endpoint(ctx, cancel, config, vppConn, tlsServerConfig, source, loopOptions, vrfOptions, subscribedChannels[0], initialDNSFanoutList)

Expand All @@ -352,7 +341,7 @@ func main() {
}

// Update the nseList to make sure we have all registered vl3-endpoints
nseStream, err = nseRegistryClient.Find(ctx, &registryapi.NetworkServiceEndpointQuery{
nseStream, err := nseRegistryClient.Find(ctx, &registryapi.NetworkServiceEndpointQuery{
NetworkServiceEndpoint: &registryapi.NetworkServiceEndpoint{
NetworkServiceNames: config.ServiceNames,
},
Expand All @@ -361,9 +350,7 @@ func main() {
if err != nil {
log.FromContext(ctx).Fatalf("error getting nses: %+v", err)
}
nseList = registryapi.ReadNetworkServiceEndpointList(nseStream)

initialDNSFanoutList = make([]url.URL, len(nseList))
var nseList = registryapi.ReadNetworkServiceEndpointList(nseStream)

for i := 0; i < len(nseList); i++ {
subscribedChannels = append(subscribedChannels, make(chan *ipam.PrefixResponse, 1))
Expand Down Expand Up @@ -400,8 +387,8 @@ func main() {

for _, config := range conn.Context.GetDnsContext().GetConfigs() {
for _, nameserverAddress := range config.DnsServerIps {
initialDNSFanoutList[i] = url.URL{Scheme: "tcp", Host: fmt.Sprintf("%v:53", nameserverAddress)}
log.FromContext(ctx).Infof("Added dns server to fanout: %v", initialDNSFanoutList[i])
initialDNSFanoutList = append(initialDNSFanoutList, url.URL{Scheme: "tcp", Host: fmt.Sprintf("%v:53", nameserverAddress)})
log.FromContext(ctx).Infof("Added dns server to fanout: %v", initialDNSFanoutList[len(initialDNSFanoutList)-1])
}
}

Expand Down