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

[IPv6] Fix reconcileFrontendIPConfigs() #3914

Merged
merged 2 commits into from Jun 6, 2023

Conversation

lzhecheng
Copy link
Contributor

@lzhecheng lzhecheng commented May 19, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

[IPv6] Fix reconcileFrontendIPConfigs(). Current logic handles lb.FrontendIPConfigurations according to Service's IP family, which is incorrect. For an IPv6 cluster, there're still some IPv4 FIPs due to Azure limitation, which will be removed. For an IPv4 cluster, all resources are of IPv4, which is not affected.

Which issue(s) this PR fixes:

Fixes #4038

Special notes for your reviewer:

Does this PR introduce a user-facing change?

[IPv6] Fix reconcileFrontendIPConfigs(). Current logic handles lb.FrontendIPConfigurations according to Service's IP family, which is incorrect. For an IPv6 cluster, there're still some IPv4 FIPs due to Azure limitation, which will be removed. For an IPv4 cluster, all resources are of IPv4, which is not affected.

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 May 19, 2023
@netlify
Copy link

netlify bot commented May 19, 2023

Deploy Preview for kubernetes-sigs-cloud-provide-azure canceled.

Name Link
🔨 Latest commit df99c1c
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cloud-provide-azure/deploys/647daa8e3d64720008e43471

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lzhecheng

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 May 19, 2023
@lzhecheng
Copy link
Contributor Author

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

@lzhecheng
Copy link
Contributor Author

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

pkg/provider/azure_utils.go Show resolved Hide resolved
pkg/provider/azure_utils.go Outdated Show resolved Hide resolved
handleFrontendIPConfig := func(isIPv6 bool) error {
ownedFIPConfig, toDeleteConfigsSingleStack, changed, newConfigs, err := az.reconcileFrontendIPConfigsSingleStack(clusterName, service, lb, lbStatus, wantLb, isIPv6, lbFrontendIPConfigName[isIPv6], &subnet)
ownedFIPConfig, toDeleteConfigsSingleStack, changed, newConfigs, err := az.reconcileFrontendIPConfigsSingleStack(clusterName, service, lb, lbStatus, wantLb, isIPv6, newConfigs[isIPv6], lbFrontendIPConfigName[isIPv6], &subnet)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we have had lb here in the parameters, why bother to build a list fip configs outside of the function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because vXEnabled -> handleFrontendIPConfig() -> reconcileFrontendIPConfigsSingleStack().
If the Service is single stack, we need to handle the newConfigs of the other IP family outside.

@lzhecheng lzhecheng force-pushed the fix-ipv6-fip branch 3 times, most recently from 66a7f31 to 1c4679d Compare May 22, 2023 23:40
@lzhecheng
Copy link
Contributor Author

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

@jwtty
Copy link
Member

jwtty commented May 25, 2023

LGTM

}
if pip.PublicIPAddressPropertiesFormat != nil {
if exist && pip.PublicIPAddressPropertiesFormat != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible that the ipv6 public IP has not yet been created?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It won't. One evidence is that the warning in isFIPIPv6() shouldn't appear in CCM log: "Checking IP Family of frontend IP configuration %q but it is not clear. It's considered to be IPv4".

}

klog.Errorf("Checking IP Family of frontend IP configuration %q but it is not clear. It's considered to be IPv4", pointer.StringDeref(fip.Name, ""))
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be Warningf here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@nilo19
Copy link
Contributor

nilo19 commented May 26, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 26, 2023
@lzhecheng
Copy link
Contributor Author

/hold
Will manually check ccm log after all tests finish to see if isFIPIPv6 is working properly.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 26, 2023
@lzhecheng
Copy link
Contributor Author

/retest

@lzhecheng
Copy link
Contributor Author

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

@lzhecheng
Copy link
Contributor Author

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

@lzhecheng
Copy link
Contributor Author

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

@lzhecheng
Copy link
Contributor Author

/retest

2 similar comments
@lzhecheng
Copy link
Contributor Author

/retest

@lzhecheng
Copy link
Contributor Author

/retest

expectedDirty bool
expectedFIPs []network.FrontendIPConfiguration
}{
{
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a test case for reconciling existing configs owned by the service without touching the others?

Copy link
Contributor

Choose a reason for hiding this comment

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

also add some negative cases please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

UT added.

// First check private
// For an external LB, the FIP's private IP address is empty. The logic will
// go through this part and check public IP address then.
if fip.FrontendIPConfigurationPropertiesFormat != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I checked all the refs of this function. If we can make sure the fip is always owned by the service, the pip check is not needed.

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 FIP also needs to be isPrimaryService==true. If it is the secondary Service, I think the pip check is still needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the fip is owned by a single stack service, we can check the service instead of pip, no matter if it is primary or secondary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It makes sense for single stack svc. Updated.

@feiskyer
Copy link
Member

feiskyer commented Jun 5, 2023

Will manually check ccm log after all tests finish to see if isFIPIPv6 is working properly.

Have the test finished?

@lzhecheng
Copy link
Contributor Author

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

@feiskyer the tests are manually triggered like above. Those runs before were successful

Signed-off-by: Zhecheng Li <zhechengli@microsoft.com>
@lzhecheng
Copy link
Contributor Author

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

Current logic handles lb.FrontendIPConfigurations according
to Service's IP family, which is incorrect. For an IPv6 cluster,
there're still some IPv4 FIPs due to Azure limitation, which
will be removed. For an IPv4 cluster, all resources are of IPv4,
which is not affected.

Signed-off-by: Zhecheng Li <zhechengli@microsoft.com>
@lzhecheng
Copy link
Contributor Author

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

@lzhecheng
Copy link
Contributor Author

/retest

@MartinForReal
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 6, 2023
if err := az.fillSubnet(subnet, *subnetName); err != nil {
return false, err
if subnet == nil {
return false, fmt.Errorf("isFrontendIPChanged: Unexpected nil subnet")
Copy link
Member

Choose a reason for hiding this comment

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

nit: can we include subnet name in the error msg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's do it in the next PR.

@lzhecheng
Copy link
Contributor Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 6, 2023
@lzhecheng
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit 9216589 into kubernetes-sigs:master Jun 6, 2023
23 checks passed
@lzhecheng lzhecheng deleted the fix-ipv6-fip branch June 6, 2023 09:03
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix or reduce frequency or switch off perma-failing jobs
6 participants