Merge pull request #22044 from davidopp/wait

Auto commit by PR queue bot
pull/6/head
k8s-merge-robot 2016-02-26 10:33:15 -08:00
commit cab55f856b
1 changed files with 4 additions and 1 deletions

View File

@ -75,6 +75,7 @@ func (rc *RouteController) reconcile(nodes []api.Node, routes []*cloudprovider.R
for _, route := range routes {
routeMap[route.TargetInstance] = route
}
wg := sync.WaitGroup{}
for _, node := range nodes {
// Skip if the node hasn't been assigned a CIDR yet.
if node.Spec.PodCIDR == "" {
@ -89,15 +90,17 @@ func (rc *RouteController) reconcile(nodes []api.Node, routes []*cloudprovider.R
DestinationCIDR: node.Spec.PodCIDR,
}
nameHint := string(node.UID)
wg.Add(1)
go func(nameHint string, route *cloudprovider.Route) {
if err := rc.routes.CreateRoute(rc.clusterName, nameHint, route); err != nil {
glog.Errorf("Could not create route %s %s: %v", nameHint, route.DestinationCIDR, err)
}
wg.Done()
}(nameHint, route)
}
nodeCIDRs[node.Name] = node.Spec.PodCIDR
}
wg := sync.WaitGroup{}
wg.Wait()
for _, route := range routes {
if rc.isResponsibleForRoute(route) {
// Check if this route applies to a node we know about & has correct CIDR.