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

retain for hpa controlled Deployment resource (labels method) #4078

Merged
merged 1 commit into from
Sep 21, 2023

Conversation

chaosi-zju
Copy link
Member

@chaosi-zju chaosi-zju commented Sep 19, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

Write a controller to watch the creation of HPA. Once there is a change in HPA, It will add a label to the target resource pointed by HPA. Then we only need to check if the resource has this specific label here to determine whether we need to perform the retain operation.

Which issue(s) this PR fixes:

part of #4058

Special notes for your reviewer:

another mthod:#4075

we should choose just one between two.

Test Method:same as #4064

Test Report:

image
image
image
image

Does this PR introduce a user-facing change?:

`karmada-controller-manager`: Now the replicas of deployments can be automatically retained if it is scaling with an HPA.

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 19, 2023
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 19, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 20, 2023

Codecov Report

Patch coverage: 5.12% and project coverage change: -0.29% ⚠️

Comparison is base (68f4ac7) 53.79% compared to head (a4828cc) 53.51%.

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4078      +/-   ##
==========================================
- Coverage   53.79%   53.51%   -0.29%     
==========================================
  Files         232      234       +2     
  Lines       23144    23281     +137     
==========================================
+ Hits        12450    12458       +8     
- Misses      10016    10142     +126     
- Partials      678      681       +3     
Flag Coverage Δ
unittests 53.51% <5.12%> (-0.29%) ⬇️

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

Files Changed Coverage Δ
...pareplicassyncer/hpa_replicas_syncer_controller.go 44.59% <0.00%> (+4.35%) ⬆️
...hpareplicassyncer/hpa_replicas_syncer_predicate.go 0.00% <0.00%> (ø)
...trollers/hpareplicassyncer/hpa_scale_ref_worker.go 0.00% <0.00%> (ø)
pkg/resourceinterpreter/default/native/retain.go 6.18% <37.50%> (+6.18%) ⬆️
...ourceinterpreter/default/native/aggregatestatus.go 70.93% <100.00%> (+0.06%) ⬆️

... and 1 file with indirect coverage changes

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

@chaosi-zju
Copy link
Member Author

@chaunceyjiang hello, for yesterday's hpa retain problem, I also achieve label method version, do you have time review this?

@chaosi-zju
Copy link
Member Author

@lxtywypc hello, my this PR may have some conflict with your #4072, do you have time helping review my this PR? we can talk about what is the best practice to merge our two PR~

@chaosi-zju
Copy link
Member Author

@XiShanYongYe-Chang it is ready to review

@chaosi-zju chaosi-zju force-pushed the retain-2 branch 4 times, most recently from ee4abc1 to 28f481f Compare September 20, 2023 08:41
@chaosi-zju
Copy link
Member Author

I have refactored my code to adapt to #4072, avoiding potential conflict. @XiShanYongYe-Chang

@XiShanYongYe-Chang
Copy link
Member

Hi @chaosi-zju, #4072 has been merged, can you help rebase it?

@XiShanYongYe-Chang
Copy link
Member

/assign

@chaosi-zju
Copy link
Member Author

Hi @chaosi-zju, #4072 has been merged, can you help rebase it?

done

@lxtywypc
Copy link
Contributor

@lxtywypc hello, my this PR may have some conflict with your #4072, do you have time helping review my this PR? we can talk about what is the best practice to merge our two PR~

Hi @chaosi-zju I'm sorry for noticing this late.

Thanks for your refactoring, I will help review it now.

@chaosi-zju chaosi-zju force-pushed the retain-2 branch 2 times, most recently from 088643c to 53a3032 Compare September 21, 2023 03:39
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 a lot~

@chaosi-zju chaosi-zju force-pushed the retain-2 branch 4 times, most recently from abf54a8 to 7a320a2 Compare September 21, 2023 10:42
@XiShanYongYe-Chang
Copy link
Member

Ask an again review from @chaunceyjiang @lxtywypc

@XiShanYongYe-Chang
Copy link
Member

Thanks~
/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 21, 2023
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/approve

@chaunceyjiang @lxtywypc
Please feel free to leave your comments here or #4058 if we missed something :) We still have time to iterate it.

@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

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 Sep 21, 2023
@karmada-bot karmada-bot merged commit 681515f into karmada-io:master Sep 21, 2023
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants