Check all backends for vmss and standard instances

This commit is contained in:
Pengfei Ni 2018-04-20 09:48:33 +08:00
parent efb7ae6ebc
commit c69cea41a0
2 changed files with 20 additions and 16 deletions

View File

@ -630,13 +630,15 @@ func (as *availabilitySet) ensureHostInPool(serviceName string, nodeName types.N
// sets, the same network interface couldn't be added to more than one load balancer of // sets, the same network interface couldn't be added to more than one load balancer of
// the same type. Omit those nodes (e.g. masters) so Azure ARM won't complain // the same type. Omit those nodes (e.g. masters) so Azure ARM won't complain
// about this. // about this.
backendPool := *newBackendPools[0].ID for _, pool := range newBackendPools {
matches := backendPoolIDRE.FindStringSubmatch(backendPool) backendPool := *pool.ID
if len(matches) == 2 { matches := backendPoolIDRE.FindStringSubmatch(backendPool)
lbName := matches[1] if len(matches) == 2 {
if strings.HasSuffix(lbName, InternalLoadBalancerNameSuffix) == isInternal { lbName := matches[1]
glog.V(4).Infof("Node %q has already been added to LB %q, omit adding it to a new one", nodeName, lbName) if strings.HasSuffix(lbName, InternalLoadBalancerNameSuffix) == isInternal {
return nil glog.V(4).Infof("Node %q has already been added to LB %q, omit adding it to a new one", nodeName, lbName)
return nil
}
} }
} }
} }

View File

@ -627,13 +627,15 @@ func (ss *scaleSet) ensureHostsInVMSetPool(serviceName string, backendPoolID str
// the same network interface couldn't be added to more than one load balancer of // the same network interface couldn't be added to more than one load balancer of
// the same type. Omit those nodes (e.g. masters) so Azure ARM won't complain // the same type. Omit those nodes (e.g. masters) so Azure ARM won't complain
// about this. // about this.
backendPool := *newBackendPools[0].ID for _, pool := range newBackendPools {
matches := backendPoolIDRE.FindStringSubmatch(backendPool) backendPool := *pool.ID
if len(matches) == 2 { matches := backendPoolIDRE.FindStringSubmatch(backendPool)
lbName := matches[1] if len(matches) == 2 {
if strings.HasSuffix(lbName, InternalLoadBalancerNameSuffix) == isInternal { lbName := matches[1]
glog.V(4).Infof("vmss %q has already been added to LB %q, omit adding it to a new one", vmSetName, lbName) if strings.HasSuffix(lbName, InternalLoadBalancerNameSuffix) == isInternal {
return nil glog.V(4).Infof("vmss %q has already been added to LB %q, omit adding it to a new one", vmSetName, lbName)
return nil
}
} }
} }
} }
@ -696,7 +698,7 @@ func (ss *scaleSet) EnsureHostsInPool(serviceName string, nodes []*v1.Node, back
for ssName, instanceIDs := range scalesets { for ssName, instanceIDs := range scalesets {
// Only add nodes belonging to specified vmSet to basic LB backends. // Only add nodes belonging to specified vmSet to basic LB backends.
if !ss.useStandardLoadBalancer() && ssName != vmSetName { if !ss.useStandardLoadBalancer() && !strings.EqualFold(ssName, vmSetName) {
continue continue
} }
@ -859,7 +861,7 @@ func (ss *scaleSet) EnsureBackendPoolDeleted(poolID, vmSetName string, backendAd
for ssName := range scalesets { for ssName := range scalesets {
// Only remove nodes belonging to specified vmSet to basic LB backends. // Only remove nodes belonging to specified vmSet to basic LB backends.
if !ss.useStandardLoadBalancer() && ssName != vmSetName { if !ss.useStandardLoadBalancer() && !strings.EqualFold(ssName, vmSetName) {
continue continue
} }