-
Notifications
You must be signed in to change notification settings - Fork 917
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
add replicas syncer for resources with HPA #4072
Conversation
Codecov ReportPatch coverage:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #4072 +/- ##
==========================================
- Coverage 53.80% 53.79% -0.02%
==========================================
Files 231 232 +1
Lines 23013 23144 +131
==========================================
+ Hits 12383 12451 +68
- Misses 9957 10015 +58
- Partials 673 678 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
/assign |
546b202
to
ea4500d
Compare
I'm not familiar with the |
Hi @lxtywypc Can we not add the logic related to webhook first? Can we consider adding a finalizer for HPA? The controller we added can be set to closed by default, but once the webhook is set, it will always take effect. Therefore, there may be inconsistencies between these two behaviors. |
Okay, I will give a try. |
I think we can focus on building the controller with this PR (for the finalizer thing, we can do it by a follow-up), which helps keep PR small and easy for review and testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot~
I skipped the logic related to webhook when I reviewed it.
9b96f9d
to
1c49f9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot~
pkg/controllers/hpareplicassyncer/hpa_replicas_syncer_controller.go
Outdated
Show resolved
Hide resolved
pkg/controllers/hpareplicassyncer/hpa_replicas_syncer_controller.go
Outdated
Show resolved
Hide resolved
pkg/controllers/hpareplicassyncer/hpa_replicas_syncer_controller.go
Outdated
Show resolved
Hide resolved
pkg/controllers/hpareplicassyncer/hpa_replicas_syncer_controller.go
Outdated
Show resolved
Hide resolved
1c49f9e
to
d830ebf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot~
Just one little suggestion. Other parts LGTM
d830ebf
to
08c0c50
Compare
Signed-off-by: lxtywypc <[email protected]>
08c0c50
to
5ae8178
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot~
/lgtm
/cc @RainbowMango @chaosi-zju
@XiShanYongYe-Chang: GitHub didn't allow me to request PR reviews from the following users: chaosi-zju. Note that only karmada-io members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
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/test-infra repository. |
/assign |
Thanks @chaunceyjiang |
return nil | ||
} | ||
|
||
if scale.Spec.Replicas != hpa.Status.CurrentReplicas { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why you are using CurrentReplicas
instead of DesiredReplicas
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the .status.currentReplicas
represents the real replicas of a managed workload, but the .status.desiredReplicas
is the planned replicas which might not represent the current situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you! Thanks!
I wrote it in the issue, and I wrote it wrong.
We really should use DesiredReplicas
, which is the replicas described by spec in the member cluster:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lxtywypc, can you help update it?
Wait a moment, Let me have a try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chaunceyjiang
I guess you mean the .spec.replicas
represents desired
replicas that match the definition of .status.desiredReplicas
in HPA, right?
The difference between the two approaches is when to sync replicas. after
and before
replica change. It makes more sense to sync desired replicas
, it looks like the HPA in the Karmada control plane scales the workload :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lxtywypc How do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you mean the .spec.replicas represents desired replicas that match the definition of .status.desiredReplicas in HPA, right?
Yes. I mean exactly this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I prefer to use .status.desiredReplicas
because its meaning is consistent with .spec.replicas
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @chaunceyjiang, it sounds good to me.
Given following task relies on this controller, I suppose we can move this forward, and leave another task for this.
What do you think? @chaunceyjiang @XiShanYongYe-Chang @lxtywypc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
return false | ||
} | ||
|
||
return oldHPA.Status.CurrentReplicas != newHPA.Status.CurrentReplicas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why you use CurrentReplicas
insterd of DesiredReplicas
Now we have different views on whether to use For now, whether to use What do you think? @lxtywypc @chaunceyjiang @RainbowMango |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks~
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
[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 |
What type of PR is this?
/kind feature
What this PR does / why we need it:
As #4057
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: