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

Fix Azure SLB support for multiple backend pools #76691

Merged
merged 1 commit into from
Apr 18, 2019

Conversation

feiskyer
Copy link
Member

Azure VM and vmssVM support multiple backend pools for the same SLB, but
not for different LBs.

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:

SLB backend pools are empty if outbound rules are defined in a separate backend pool.

This is because, although we added the check for not adding the backend pools from different LBs, the lbName is not checked.

This PR fixes the issue by also checking the LB name.

Which issue(s) this PR fixes:

Fixes #76687

Special notes for your reviewer:

Should cherry pick to old releases.

Does this PR introduce a user-facing change?:

Ensure the backend pools are set correctly for Azure SLB with multiple backend pools (e.g. outbound rules)

/kind bug
/sig azure
/priority critial-urgent

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. sig/azure needs-priority Indicates a PR lacks a `priority/foo` label and requires one. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 17, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feiskyer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cloudprovider sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. labels Apr 17, 2019
@feiskyer
Copy link
Member Author

/priority critical-urgent
/assign @andyzhangx @khenidak

@k8s-ci-robot k8s-ci-robot added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 17, 2019
@feiskyer
Copy link
Member Author

/test pull-kubernetes-e2e-aks-engine-azure

@feiskyer feiskyer added cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. and removed cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. labels Apr 17, 2019
@feiskyer
Copy link
Member Author

/retest

Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to combine the code change (use a standalone function?) under vmas and vmss, it's quite similar:

			newBackendPoolsIDs := make([]string, 0, len(newBackendPools))
			for _, pool := range newBackendPools {				for _, pool := range newBackendPools {
				backendPool := *pool.ID					if pool.ID != nil {
				matches := backendPoolIDRE.FindStringSubmatch(backendPool)						newBackendPoolsIDs = append(newBackendPoolsIDs, *pool.ID)
				if len(matches) == 2 {	
					lbName := matches[1]	
					if strings.HasSuffix(lbName, InternalLoadBalancerNameSuffix) == isInternal {	
						klog.V(4).Infof("Node %q has already been added to LB %q, omit adding it to a new one", nodeName, lbName)	
						return nil	
					}	
				}					}
			}				}
			isSameLB, oldLBName, err := isBackendPoolOnSameLB(backendPoolID, newBackendPoolsIDs)
			if err != nil {
				return err
			}
			if !isSameLB {
				klog.V(4).Infof("Node %q has already been added to LB %q, omit adding it to a new one", nodeName, oldLBName)
				return nil
			}

@feiskyer
Copy link
Member Author

is it possible to combine the code change (use a standalone function?) under vmas and vmss, it's quite similar

that's already done in func isBackendPoolOnSameLB(). The other parts couldn't be combined because of different data struct.

@feiskyer
Copy link
Member Author

@andyzhangx Addressed comments. PTAL

@feiskyer
Copy link
Member Author

/retest

Azure VM and vmssVM support multiple backend pools for the same SLB, but
not for different LBs.
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 18, 2019
Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot merged commit 8f09fd6 into kubernetes:master Apr 18, 2019
@feiskyer feiskyer deleted the slb-multi-backendpool branch April 18, 2019 08:10
k8s-ci-robot added a commit that referenced this pull request Apr 19, 2019
…91-upstream-release-1.12

Automated cherry pick of #76691: Fix Azure SLB support for multiple backend pools
k8s-ci-robot added a commit that referenced this pull request Apr 23, 2019
…91-upstream-release-1.11

Automated cherry pick of #76691: Fix Azure SLB support for multiple backend pools
k8s-ci-robot added a commit that referenced this pull request Apr 26, 2019
…91-upstream-release-1.13

Automated cherry pick of #76691: Fix Azure SLB support for multiple backend pools
k8s-ci-robot added a commit that referenced this pull request May 1, 2019
…91-upstream-release-1.14

Automated cherry pick of #76691: Fix Azure SLB support for multiple backend pools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cloudprovider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SLB backend pools are empty if outbound rules are defined in a separate backend pool
4 participants