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

feat: support node selection for multiple standard load balancers #4201

Merged
merged 1 commit into from Jul 13, 2023

Conversation

nilo19
Copy link
Contributor

@nilo19 nilo19 commented Jun 30, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

Support node selection for multiple standard load balancers.
When nodes are created, each node will be evaluated to see what load balancer it should be placed into.
Valid placement targets will be determined as follows (rules match from top to bottom, first match wins):

  1. If this node is in an agent pool that is selected as a primary agent pool for a load balancer, that load balancer will be the only potential placement target.
  2. If the nodeSelectors on any load balancer configurations match this node, then all load balancer configurations that match it will be potential placement targets.
  3. If no nodeSelectors on any load balancer configurations match this node, then all load balancers that do not have any nodeSelectors will be potential placement targets.

After the list of potential placement targets has been calculated, the node should be placed into the kubernetes backend pool of the load balancer with the fewest number of nodes already assigned.

Which issue(s) this PR fixes:

Fixes #
Related: #4013

Special notes for your reviewer:

Does this PR introduce a user-facing change?

feat: support node selection for multiple standard load balancers

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@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/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 30, 2023
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 30, 2023
@nilo19
Copy link
Contributor Author

nilo19 commented Jul 2, 2023

/retest

1 similar comment
@lzhecheng
Copy link
Contributor

/retest

pkg/provider/azure.go Show resolved Hide resolved
pkg/provider/azure_loadbalancer.go Show resolved Hide resolved
}
}

func (az *Cloud) removeNodeFromLBConfig(nodeNameToLBConfigIDXMap map[string]int, nodeName string) string {
Copy link
Member

Choose a reason for hiding this comment

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

could you add comments for the newly added functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

pkg/provider/azure.go Show resolved Hide resolved
multipleStandardLoadBalancerConfigurationsSynced bool
// nodesWithCorrectLoadBalancerByPrimaryVMSet marks nodes that are matched with load balancers by primary vmSet.
nodesWithCorrectLoadBalancerByPrimaryVMSet sets.Set[string]
Copy link
Member

Choose a reason for hiding this comment

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

the property is a little confusing and a lock should be added to avoid race conditions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the service reconciliation is triggered in serial, do we still need a lock to guard this?

Copy link
Member

Choose a reason for hiding this comment

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

It may be updated by different go routines, e.g. service controller and node watcher

Copy link
Contributor Author

Choose a reason for hiding this comment

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

please check the new commit

@nilo19 nilo19 force-pushed the feat/multi-slb/backend branch 2 times, most recently from 88a7901 to 34b9faa Compare July 5, 2023 02:05
@coveralls
Copy link

Coverage Status

coverage: 79.853% (+0.05%) from 79.803% when pulling 34b9faa on nilo19:feat/multi-slb/backend into 545a717 on kubernetes-sigs:master.

@nilo19
Copy link
Contributor Author

nilo19 commented Jul 7, 2023

/retest

Copy link
Member

@feiskyer feiskyer 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 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 11, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feiskyer, nilo19

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

@feiskyer feiskyer added this to the v1.28 milestone Jul 11, 2023
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 12, 2023
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 12, 2023
@nilo19
Copy link
Contributor Author

nilo19 commented Jul 12, 2023

@feiskyer squashed commits and rebased.

@feiskyer
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 13, 2023
@k8s-ci-robot k8s-ci-robot merged commit 570e938 into kubernetes-sigs:master Jul 13, 2023
16 checks passed
@nilo19 nilo19 deleted the feat/multi-slb/backend branch July 13, 2023 05:13
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants