Skip to content

Automated cherry pick of #6525: don't recreate resource in the member cluster when it is #6537

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

Conversation

luyb177
Copy link

@luyb177 luyb177 commented Jul 15, 2025

Cherry pick of #6525 on release-1.13.
#6525: don't recreate resource in the member cluster when it is
For details on the cherry pick process, see the cherry pick requests page.

`karmada-controller-manager`: Fixed the issue that resources will be recreated after being deleted on the cluster when resource is suspended for dispatching

@karmada-bot karmada-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 15, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @luyb177, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request, a cherry-pick from #6525, introduces a crucial fix to prevent the unintended recreation of resources in member clusters. Specifically, it ensures that if a Work object is marked as suspended for dispatching, the system will not attempt to re-provision the associated resource, thereby avoiding unnecessary operations and potential conflicts.

Highlights

  • Resource Recreation Prevention: The WorkStatusController's handleDeleteEvent now includes a check to see if the Work object is suspended for dispatching. If it is, the controller will skip further processing, effectively preventing the recreation of the resource in the member cluster.
  • Enhanced Test Coverage: A new test case has been added to TestWorkStatusController_syncWorkStatus to explicitly verify that resources are not recreated in the member cluster when their corresponding Work object has SuspendDispatching set to true. This improves the robustness of the controller.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a cherry-pick that prevents the work-status-controller from recreating a resource in a member cluster if the corresponding Work object has spec.suspendDispatching set to true. The change is implemented in handleDeleteEvent and is accompanied by a new test case that verifies the corrected behavior. The implementation is correct and the tests are adequate. The changes look good to me.

@XiShanYongYe-Chang XiShanYongYe-Chang mentioned this pull request Jul 15, 2025
3 tasks
@@ -294,6 +294,12 @@ func (c *WorkStatusController) handleDeleteEvent(ctx context.Context, key keys.F
return nil
}

// skip processing as the work object is suspended for dispatching.
if util.IsWorkSuspendDispatching(work) {
Copy link
Member

Choose a reason for hiding this comment

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

The file for the IsWorkSuspendDispatching method has undergone changes. In versions 1.12 and 1.13, it was still located under the helper package.

Copy link
Member

Choose a reason for hiding this comment

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

This cannot be automatically modified through the cherry-pick script; it requires your manual intervention. @luyb177

@luyb177 luyb177 force-pushed the automated-cherry-pick-of-#6525-upstream-release-1.13 branch from 5164545 to 323a571 Compare July 16, 2025 02:36
@karmada-bot karmada-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 16, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 47.99%. Comparing base (f1c322f) to head (e2df648).

Files with missing lines Patch % Lines
pkg/controllers/status/work_status_controller.go 0.00% 3 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@               Coverage Diff                @@
##           release-1.13    #6537      +/-   ##
================================================
- Coverage         47.99%   47.99%   -0.01%     
================================================
  Files               674      674              
  Lines             55872    55875       +3     
================================================
- Hits              26818    26816       -2     
- Misses            27307    27312       +5     
  Partials           1747     1747              
Flag Coverage Δ
unittests 47.99% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@luyb177 luyb177 force-pushed the automated-cherry-pick-of-#6525-upstream-release-1.13 branch from 323a571 to 4e91842 Compare July 16, 2025 03:12
@karmada-bot karmada-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 16, 2025
return nil
}

//nolint:staticcheck // SA1019 ignore deprecated util.PropagationInstruction
Copy link
Member

Choose a reason for hiding this comment

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

The PropagationInstruction may not have been deprecated in version 1.13, so this line can be removed.

@luyb177 luyb177 force-pushed the automated-cherry-pick-of-#6525-upstream-release-1.13 branch from 4e91842 to e2df648 Compare July 16, 2025 06:34
Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

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

Thanks ~
/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 16, 2025
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: XiShanYongYe-Chang

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

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 16, 2025
@karmada-bot karmada-bot merged commit 545903f into karmada-io:release-1.13 Jul 16, 2025
24 checks passed
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. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants