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 - LB Rules #8218

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

Conversation

georgeedward2000
Copy link

@georgeedward2000 georgeedward2000 commented Feb 4, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR introduces updates to LB rules and probes for the Container Load Balancer. The key changes are as follows:

  • Floating IP Disabled: The floatingIP property in the LB Rule settings is set to false.
  • Health Probes: Modifications have been made to ensure that health probes are not selected or set up.
  • Pod Target Port: The target port is now utilized in the LB Rule settings, ensuring proper routing of traffic to the intended port.

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 Feb 4, 2025
Copy link

linux-foundation-easycla bot commented Feb 4, 2025

CLA Not Signed

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: georgeedward2000
Once this PR has been reviewed and has the lgtm label, please assign lzhecheng 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

@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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 4, 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 4, 2025
@@ -2800,6 +2800,36 @@ func (az *Cloud) getExpectedLBRules(
isIPv6 bool,
) ([]*armnetwork.Probe, []*armnetwork.LoadBalancingRule, error) {
var expectedRules []*armnetwork.LoadBalancingRule
// If we are using Pod IP in the LB backend, we skip health probes, disable floating IP and use port.TargetPort.
if az.IsLBBackendPoolTypePodIP() {
// Check for multi-IP families in the service spec (not allowed for CLB).

Choose a reason for hiding this comment

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

rewrite to mention pod ip backend config instead of clb

Copy link
Author

Choose a reason for hiding this comment

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

update in the latest commit

@@ -2800,6 +2800,36 @@ func (az *Cloud) getExpectedLBRules(
isIPv6 bool,

Choose a reason for hiding this comment

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

add PR desc

Copy link
Author

Choose a reason for hiding this comment

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

updated the PR description

// Turn off floating IP and skip health probe attachments.
props.EnableFloatingIP = ptr.To(false)
props.Probe = nil
props.BackendPort = ptr.To(int32(port.TargetPort.IntValue()))

Choose a reason for hiding this comment

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

I think we won't be able to support named Port (https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports). Better to throw a validation error.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 10, 2025
@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
@@ -382,8 +382,7 @@ const (
// LoadBalancerBackendPoolConfigurationTypeNodeIP is the lb backend pool config type node ip
LoadBalancerBackendPoolConfigurationTypeNodeIP = "nodeIP"
// LoadBalancerBackendPoolConfigurationTypePODIP is the lb backend pool config type pod ip
// TODO (nilo19): support pod IP in the future
LoadBalancerBackendPoolConfigurationTypePODIP = "podIP"
LoadBalancerBackendPoolConfigurationTypePodIP = "podIP"
)
Copy link
Member

Choose a reason for hiding this comment

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

Good catch for the variable name here👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Have we decided to use this instead of loadBalancerClass?

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 also a set of lint failures, could you rebase the PR to master branch?

// Build rules for each service port but with floatingIP = false, no health probes.
for _, port := range service.Spec.Ports {
if port.TargetPort.Type == intstr.String {
return nil, nil, fmt.Errorf("named targetPort is not supported when LB backend pool type is PodIP: %s", port.TargetPort.StrVal)
Copy link
Member

Choose a reason for hiding this comment

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

are we able to make port name work?

Choose a reason for hiding this comment

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

Since, CLB directly rewrites the Destination Port in the packet after selecting the Destination POD, I think we can't support named Port specified in https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Feb 18, 2025
@k8s-ci-robot k8s-ci-robot removed 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 Feb 18, 2025
if az.IsLBBackendPoolTypePodIP() {
// Check for multi-IP families in the service spec (not allowed for BackendPool of type PodIP).
if len(service.Spec.IPFamilies) > 1 {
return nil, nil, fmt.Errorf("dual-stack services are not supported when LB backend pool type is PodIP")
Copy link
Contributor

@nilo19 nilo19 Feb 20, 2025

Choose a reason for hiding this comment

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

In the design doc it says "For dual stack, 2 services need to be created". Can you double check which one is the right behavior?

Copy link
Author

Choose a reason for hiding this comment

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

yes, that is right. Should I update the error string to say precisely that?

@@ -2815,6 +2816,39 @@ func (az *Cloud) getExpectedLBRules(
isIPv6 bool,
) ([]*armnetwork.Probe, []*armnetwork.LoadBalancingRule, error) {
var expectedRules []*armnetwork.LoadBalancingRule
// If we are using Pod IP in the LB backend, we skip health probes, disable floating IP and use port.TargetPort.
if az.IsLBBackendPoolTypePodIP() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please extract this as a new func to make the main loop concise?

@@ -180,6 +180,10 @@ func (az *Config) IsLBBackendPoolTypeNodeIP() bool {
return strings.EqualFold(az.LoadBalancerBackendPoolConfigurationType, consts.LoadBalancerBackendPoolConfigurationTypeNodeIP)
}

func (az *Config) IsLBBackendPoolTypePodIP() bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Need a check to block podIP + non-standardV2?

Copy link
Contributor

Choose a reason for hiding this comment

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

If conflicted with multi-slb, need to block as well.

@nilo19
Copy link
Contributor

nilo19 commented Feb 20, 2025

I think for features under development, release note should be none, as they have no impact to the user for now. @feiskyer correct me if wrong.

@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
@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.

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