Skip to content

Conversation

danbosscher
Copy link

@danbosscher danbosscher commented Sep 18, 2025

Problem

When IP tags specified in service annotations don't match the existing public IP tags, the current logic in shouldReleaseExistingOwnedPublicIP returns true to delete and recreate the entire public IP. This is inefficient and causes unnecessary downtime.

Referenced issue: #9125

Solution

This PR implements updating IP tags in-place instead of recreating the entire public IP resource.

Changes Made:

  1. Modified shouldReleaseExistingOwnedPublicIP function:

    • Removed the condition that caused PIP deletion when IP tags didn't match
    • Added comment explaining that IP tag mismatches should be handled by updating
  2. Added ensurePIPIPTagged function:

    • New helper function that handles IP tag updates similar to regular tag updates
    • Compares current and desired IP tags using existing areIPTagsEquivalent function
    • Updates PIP's IP tags when they differ from service annotation requirements
  3. Integrated IP tag updates into reconciliation flow:

    • Added call to ensurePIPIPTagged alongside existing ensurePIPTagged
    • Ensures both regular tags and IP tags are updated during PIP reconciliation
  4. Updated tests:

    • Modified existing TestShouldReleaseExistingOwnedPublicIP test cases
    • Added comprehensive TestEnsurePIPIPTagged with 4 test scenarios

Benefits:

  • Performance improvement: Avoids unnecessary deletion and recreation of public IPs
  • Reduced downtime: Updates are faster than recreating resources
  • Consistency: Handles IP tags the same way as regular tags
  • Backward compatibility: No breaking changes to existing functionality

Testing:

  • ✅ All existing tests pass
  • ✅ New comprehensive test coverage for IP tag update functionality
  • ✅ Updated existing tests to reflect new behavior
  • ✅ Code compiles successfully

The implementation follows existing Azure cloud provider patterns and maintains all safety checks while optimizing the IP tag update process.

When IP tags specified in service annotations don't match the existing
public IP tags, the current logic deletes and recreates the entire PIP.
This is inefficient and causes unnecessary downtime.

This change:
- Removes IP tag mismatch as a reason to delete PIPs in shouldReleaseExistingOwnedPublicIP
- Adds ensurePIPIPTagged function to update IP tags in-place
- Integrates IP tag updates into the PIP reconciliation flow
- Updates existing tests to reflect the new behavior
- Adds comprehensive tests for the new IP tag update functionality

Benefits:
- Improved performance by avoiding PIP recreation
- Reduced service downtime during IP tag updates
- Consistent handling of IP tags similar to regular tags

Fixes: https://github.com/kubernetes-sigs/cloud-provider-azure/blob/master/pkg/provider/azure_loadbalancer.go#L3242
@k8s-ci-robot
Copy link
Contributor

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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 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 Sep 18, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: danbosscher
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

Copy link

linux-foundation-easycla bot commented Sep 18, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: danbosscher / name: Daniel Bosscher (862dee9)

@k8s-ci-robot
Copy link
Contributor

Welcome @danbosscher!

It looks like this is your first PR to kubernetes-sigs/cloud-provider-azure 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cloud-provider-azure has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@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 Sep 18, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @danbosscher. 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 cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Sep 18, 2025
@github-actions github-actions bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Sep 18, 2025
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Sep 18, 2025
@feiskyer
Copy link
Member

/ok-to-test
/kind feature

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. kind/feature Categorizes issue or PR as related to a new feature. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. do-not-merge/needs-kind labels Sep 22, 2025
@k8s-ci-robot
Copy link
Contributor

@danbosscher: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cloud-provider-azure-unit 862dee9 link true /test pull-cloud-provider-azure-unit

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. kind/feature Categorizes issue or PR as related to a new feature. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

3 participants