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: NSG destination IP version same as LB IP for floating ip disabled services #2230

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

jwtty
Copy link
Member

@jwtty jwtty commented Aug 29, 2022

What type of PR is this?

/kind bug

What this PR does / why we need it:

When service has floating ip disabled, all backend private IPs are added in nsg rule as destination addresses.
In a dual stack cluster, this includes both IPv4 and IPv6 addresses that nsg does not support.
So in this scenario, we only select private IPs with the same version as service LB IP to be included in nsg.

Which issue(s) this PR fixes:

Fixes #2218

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fix nsg reconciliation failure for floating-ip-disabled services in dual-stack clusters.

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/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 29, 2022
@netlify
Copy link

netlify bot commented Aug 29, 2022

Deploy Preview for kubernetes-sigs-cloud-provide-azure ready!

Name Link
🔨 Latest commit 95353cb
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cloud-provide-azure/deploys/630ce7bc987a030009c47b27
😎 Deploy Preview https://deploy-preview-2230--kubernetes-sigs-cloud-provide-azure.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 29, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jwtty

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 29, 2022
@jwtty
Copy link
Member Author

jwtty commented Aug 29, 2022

/test pull-cloud-provider-azure-e2e-ccm-vmss-capz

@jwtty
Copy link
Member Author

jwtty commented Aug 30, 2022

/test pull-cloud-provider-azure-e2e-ccm-vmss-basic-lb

1 similar comment
@jwtty
Copy link
Member Author

jwtty commented Aug 30, 2022

/test pull-cloud-provider-azure-e2e-ccm-vmss-basic-lb

@@ -2309,6 +2308,22 @@ func (az *Cloud) reconcileSecurityGroup(clusterName string, service *v1.Service,
disableFloatingIP = true
}

backendIPAddresses := make([]string, 0)
if disableFloatingIP {
lb, exist, err := az.getAzureLoadBalancer(to.String(lbName), azcache.CacheReadTypeDefault)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think updated slb is returned in the previous function call. Do we need to invoke get slb again?

Copy link
Member Author

Choose a reason for hiding this comment

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

That was my first implementation. But then I found when the service was first created, that lb returned from the previous function call has an empty backendpool. (nodes are added later and that variable does not contain them.) And the getPrivateIPs would return nothing. That's why I call a getLB here.

@jwtty
Copy link
Member Author

jwtty commented Aug 30, 2022

/test pull-cloud-provider-azure-e2e-ccm-vmss-basic-lb

@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 Aug 31, 2022
@k8s-ci-robot k8s-ci-robot merged commit 5d64b4d into kubernetes-sigs:master Aug 31, 2022
@jwtty jwtty deleted the dual_stack branch August 31, 2022 07:26
@jwtty
Copy link
Member Author

jwtty commented Aug 31, 2022

/cherrypick release-1.0

@jwtty
Copy link
Member Author

jwtty commented Aug 31, 2022

/cherrypick release-1.1

@jwtty
Copy link
Member Author

jwtty commented Aug 31, 2022

/cherrypick release-1.23

@jwtty
Copy link
Member Author

jwtty commented Aug 31, 2022

/cherrypick release-1.24

@k8s-infra-cherrypick-robot

@jwtty: #2230 failed to apply on top of branch "release-1.0":

Applying: nsg select ip version based on lb ip
Using index info to reconstruct a base tree...
M	pkg/provider/azure_loadbalancer.go
A	pkg/provider/azure_loadbalancer_backendpool.go
M	pkg/provider/azure_loadbalancer_test.go
A	pkg/provider/azure_mock_loadbalancer_backendpool.go
M	pkg/provider/azure_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/provider/azure_test.go
CONFLICT (content): Merge conflict in pkg/provider/azure_test.go
CONFLICT (modify/delete): pkg/provider/azure_mock_loadbalancer_backendpool.go deleted in HEAD and modified in nsg select ip version based on lb ip. Version nsg select ip version based on lb ip of pkg/provider/azure_mock_loadbalancer_backendpool.go left in tree.
Auto-merging pkg/provider/azure_loadbalancer_test.go
CONFLICT (content): Merge conflict in pkg/provider/azure_loadbalancer_test.go
CONFLICT (modify/delete): pkg/provider/azure_loadbalancer_backendpool.go deleted in HEAD and modified in nsg select ip version based on lb ip. Version nsg select ip version based on lb ip of pkg/provider/azure_loadbalancer_backendpool.go left in tree.
Auto-merging pkg/provider/azure_loadbalancer.go
CONFLICT (content): Merge conflict in pkg/provider/azure_loadbalancer.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 nsg select ip version based on lb ip
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-1.0

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/test-infra repository.

@k8s-infra-cherrypick-robot

@jwtty: #2230 failed to apply on top of branch "release-1.1":

Applying: nsg select ip version based on lb ip
Using index info to reconstruct a base tree...
M	pkg/provider/azure_loadbalancer.go
A	pkg/provider/azure_loadbalancer_backendpool.go
M	pkg/provider/azure_loadbalancer_test.go
A	pkg/provider/azure_mock_loadbalancer_backendpool.go
M	pkg/provider/azure_test.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/provider/azure_test.go
CONFLICT (content): Merge conflict in pkg/provider/azure_test.go
CONFLICT (modify/delete): pkg/provider/azure_mock_loadbalancer_backendpool.go deleted in HEAD and modified in nsg select ip version based on lb ip. Version nsg select ip version based on lb ip of pkg/provider/azure_mock_loadbalancer_backendpool.go left in tree.
Auto-merging pkg/provider/azure_loadbalancer_test.go
CONFLICT (content): Merge conflict in pkg/provider/azure_loadbalancer_test.go
CONFLICT (modify/delete): pkg/provider/azure_loadbalancer_backendpool.go deleted in HEAD and modified in nsg select ip version based on lb ip. Version nsg select ip version based on lb ip of pkg/provider/azure_loadbalancer_backendpool.go left in tree.
Auto-merging pkg/provider/azure_loadbalancer.go
CONFLICT (content): Merge conflict in pkg/provider/azure_loadbalancer.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 nsg select ip version based on lb ip
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-1.1

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/test-infra repository.

@k8s-infra-cherrypick-robot

@jwtty: new pull request created: #2238

In response to this:

/cherrypick release-1.23

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/test-infra repository.

@k8s-infra-cherrypick-robot

@jwtty: new pull request created: #2239

In response to this:

/cherrypick release-1.24

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/test-infra repository.

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/bug Categorizes issue or PR as related to a bug. 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
5 participants