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

Container Load Balancer - BackendPool #8176

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

georgeedward2000
Copy link

@georgeedward2000 georgeedward2000 commented Jan 28, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR introduces the implementation of the backend pool interface for pod backend pools. The key changes are as follows:

  • Backend Pool Interface implementation: A new implementation is introduced to manage pod IPs in the backend pool. It includes functions to ensure hosts in the pool, clean up VM sets, reconcile backend pools, and get backend private IPs.
  • Instantiation of the Backend Pool implementation when the CLB is desired.
  • Unit tests

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Added the ability to set the type of backend pool to PodIP. 
This action allows the Load balancer attached to the service to route traffic directly to the containers, 
instead of routing to AKS nodes and then AKS node routing it to the PODs hosting the service.

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


@k8s-ci-robot k8s-ci-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Jan 28, 2025
Copy link

linux-foundation-easycla bot commented Jan 28, 2025

CLA Not Signed

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/needs-kind labels Jan 28, 2025
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 28, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @georgeedward2000. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 28, 2025
@georgeedward2000 georgeedward2000 changed the title Clb backendpool Container Load Balancer - BackendPool Jan 28, 2025
func (bpi *backendPoolTypePodIP) CleanupVMSetFromBackendPoolByCondition(_ context.Context, _ *armnetwork.LoadBalancer, _ *v1.Service, _ []*v1.Node, _ string, _ func(string) bool) (*armnetwork.LoadBalancer, error) {
return nil, errors.New("CleanupVMSetFromBackendPoolByCondition is not applicable for pod IP backend pool")
}

Copy link

@kartickmsft kartickmsft Feb 4, 2025

Choose a reason for hiding this comment

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

Probably a comment why this function is a NOP(doesn't do anything) for POD IP based backendpool would be nice.

@@ -381,9 +381,8 @@ const (
LoadBalancerBackendPoolConfigurationTypeNodeIPConfiguration = "nodeIPConfiguration"

Choose a reason for hiding this comment

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

Can we add some PR description?


func (az *Cloud) getBackendPoolNameForCLBService(service *v1.Service) (string, error) {
if isDualStackService(service) {
return "", fmt.Errorf("dual-stack service is not supported for container load balancer")

Choose a reason for hiding this comment

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

I think we should use names hinting towards "pod ip backend". container load balancer won't mean much here

Copy link
Member

Choose a reason for hiding this comment

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

+1

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: georgeedward2000, kartickmsft
Once this PR has been reviewed and has the lgtm label, please assign feiskyer for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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
Copy link
Member

@georgeedward2000 Thanks for the contribution. Could you sign CLA?

@feiskyer
Copy link
Member

And could you use the template (the template would show when you open the PR) and fill the template contents (including release notes information together with what this PR does)?

/kind feature

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. and removed do-not-merge/needs-kind labels Feb 18, 2025
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.

there are some lint failures either, could you rebase to master?

}

func (bpi *backendPoolTypePodIP) CleanupVMSetFromBackendPoolByCondition(_ context.Context, _ *armnetwork.LoadBalancer, _ *v1.Service, _ []*v1.Node, _ string, _ func(string) bool) (*armnetwork.LoadBalancer, error) {
return nil, errors.New("CleanupVMSetFromBackendPoolByCondition is not applicable for pod IP backend pool")
Copy link
Member

Choose a reason for hiding this comment

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

return success (return nil,nil) for no-op?


func (az *Cloud) getBackendPoolNameForCLBService(service *v1.Service) (string, error) {
if isDualStackService(service) {
return "", fmt.Errorf("dual-stack service is not supported for container load balancer")
Copy link
Member

Choose a reason for hiding this comment

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

+1

return &backendPoolTypePodIP{c}
}

func (bpi *backendPoolTypePodIP) CleanupVMSetFromBackendPoolByCondition(_ context.Context, _ *armnetwork.LoadBalancer, _ *v1.Service, _ []*v1.Node, _ string, _ func(string) bool) (*armnetwork.LoadBalancer, error) {
Copy link
Member

Choose a reason for hiding this comment

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

where is the lb part? we'd need first provision lb and then create/update backend pool

Choose a reason for hiding this comment

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

If you are referring to the LB changes to support POD IP as backend, then those changes are being done as part of a different PR. Here, changes corresponding to the POD IP backendpool interface is being introduced.


switch service.Spec.IPFamilies[0] {
case v1.IPv4Protocol:
return string(service.GetUID()), nil
Copy link
Member

Choose a reason for hiding this comment

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

would we have multiple backend. pools on the same CLB? If not, I'd suggest to use service namespace+name for better matching with service object (e.g. namespace-name and namespace-name-ipv6)

Choose a reason for hiding this comment

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

CLB will have 1 LB rule(1 FIP) with 1 backendpool. I think namespace-name-ipv6 can exceed the 80 characters limit of NRP resource name. That's why we thought of using UID.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Feb 18, 2025
@k8s-ci-robot
Copy link
Contributor

Adding label do-not-merge/contains-merge-commits because PR contains merge commits, which are not allowed in this repository.
Use git rebase to reapply your commits on top of the target branch. Detailed instructions for doing so can be found here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

}

backendPrivateIPs := utilsets.NewString()
for _, bp := range lb.Properties.BackendAddressPools {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks similiar with nodeIP backend pool GetBackendPrivateIPs. Is is possible to reuse some logic as a separate func?

return backendPrivateIPs.UnsortedList(), nil
}

func (bpi *backendPoolTypePodIP) ReconcileBackendPools(ctx context.Context, _ string, service *v1.Service, lb *armnetwork.LoadBalancer) (bool, bool, *armnetwork.LoadBalancer, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to remove unwanted nodes in this func?

Choose a reason for hiding this comment

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

Endpoint-slice update resulting in endpoint (POD) removal will trigger the removal of POD from the backendpool.
Are you referring to migration scenario?

@nilo19
Copy link
Contributor

nilo19 commented Feb 20, 2025

Could you please create a github issue, list todo items and link to all related PRs?

@nilo19
Copy link
Contributor

nilo19 commented Feb 20, 2025

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Feb 20, 2025
@georgeedward2000
Copy link
Author

Could you please create a github issue, list todo items and link to all related PRs?

#8395

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/contains-merge-commits kind/feature Categorizes issue or PR as related to a new feature. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants