Remove unnecessary update and delete events in cert-rotation-controller
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
The cert-rotation-controller only need to watch the creation event of the cluster object, as the cluster object will be processed periodically, so there is no need to watch the update or deletion events of the cluster.
Which issue(s) this PR fixes:
Fixes #6780
Does this PR introduce a user-facing change?:
NONE
Welcome @yaten2302! It looks like this is your first PR to karmada-io/karmada 🎉
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign xishanyongye-chang for approval. For more information see the Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Summary of Changes
Hello @yaten2302, I'm Gemini Code Assist[^1]! 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 refines the event watching mechanism within the cert-rotation-controller by eliminating unnecessary processing of update and delete events for cluster objects. Since cluster objects are processed periodically, actively watching these events is redundant, and this change streamlines the controller's operation for improved efficiency.
Highlights
- Event Watching Optimization: The
cert-rotation-controllerhas been optimized to only watch for creation events of cluster objects, explicitly ignoring update and delete events, as periodic processing makes these watches redundant. - Predicate Function Update: The
UpdateFuncandDeleteFuncwithin theNewClusterPredicateOnAgentfunction inpkg/util/helper/predicate.gohave been modified to always returnfalse, preventing the controller from reacting to these events. - Test Case Adjustment: Corresponding test cases in
pkg/util/helper/predicate_test.gohave been updated to reflect the new behavior, asserting that update and delete events are now correctly ignored by the predicate.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| 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 pull request 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 may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
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.
[^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.
Hi @zhzhuang-zju can you help take a review? /cc @zhzhuang-zju
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 46.60%. Comparing base (679674f) to head (97dc3da).
:warning: Report is 4 commits behind head on master.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## master #6989 +/- ##
==========================================
- Coverage 46.62% 46.60% -0.02%
==========================================
Files 699 699
Lines 48164 48156 -8
==========================================
- Hits 22456 22445 -11
- Misses 24013 24016 +3
Partials 1695 1695
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 46.60% <100.00%> (-0.02%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Hi @yaten2302, there are some lint errors.
Hi @XiShanYongYe-Chang , the CI workflow which is failing, I've a doubt that, the failing test is - https://github.com/karmada-io/karmada/actions/runs/19868522315/job/56938370989?pr=6989. But, this comes under resource-status collection, right? Is this related to the cert-rotation controller.
I've fixed the linter errors though 👀 the workflow is passing for that.
/retest
@XiShanYongYe-Chang , kindly approve one pending test :)
@XiShanYongYe-Chang , ig you already have an open PR for this :)
https://github.com/karmada-io/karmada/pull/6832 in here, for the cluster-status-controller, the NewClusterPredicateOnAgent func is changed to NewClusterStatusControllerPredicateOnAgent.
Once your PR is merged, this will prevent the effect from spreading. Should I incorporate this behaviour in my PR?
You're right. Let's wait for my PR to be merged first, so you can rebase later.
If you are willing to continue contributing, you can follow up on this issue: https://github.com/karmada-io/karmada/issues/6952
You're right. Let's wait for my PR to be merged first, so you can rebase later.
Sure 👍
If you are willing to continue contributing, you can follow up on this issue: https://github.com/karmada-io/karmada/issues/6952
Yes, I'm willing to contribute more to the project, I'll pick up one more good first issue and then I'll probably try to find some good ones, like major changes/refactor/bugs or anything required at that point.
BTW, is there is any medium for communication like slack channel or community calls? I've joined the karmada-dev channel in CNCF slack, but that's quite inactive ig? is that only the medium for communications and all?
BTW, is there is any medium for communication like slack channel or community calls? I've joined the
karmada-devchannel in CNCF slack, but that's quite inactive ig? is that only the medium for communications and all?
Currently using the Karmada channel in CNCF Slack.