Skip to content

fix deployment replicas syncer in case that status.replicas haven't been collected from member cluster to template #4729

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

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

chaosi-zju
Copy link
Member

@chaosi-zju chaosi-zju commented Mar 20, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR mainly handles two problem:

1、Problem 1

we should make sure the latest collected status.replicas is synced from binding to template.

e.g: user set deployment.spec.replicas = 2, then sum replicas in binding.status becomes 2, however, if now deployment.status.replicas is still 1, we shouldn't update spec.replicas to 1 until status.replicas becomes 2.

2、Problem 2

as described in #4758, fix deployment replicas syncer in case that the status.replicas in aggregatedStatus of binding is 0.

actually, if member cluster deployment is controlled by hpa, its status.replicas must > 0 (since hpa.minReplicas > 0),

so, if its status.replicas is 0, means the status haven't been collected from member cluster, and needs waiting before do the following update.

Which issue(s) this PR fixes:

Fixes #4758

Special notes for your reviewer:

bugfix for #4707

Does this PR introduce a user-facing change?:

fix deployment replicas syncer in case that `status.replicas` haven't been collected from member cluster to template.

@karmada-bot karmada-bot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 20, 2024
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 20, 2024
@chaosi-zju
Copy link
Member Author

chaosi-zju commented Mar 20, 2024

@XiShanYongYe-Chang @chaunceyjiang can you review on this? thanks very much for your precious time!

@codecov-commenter
Copy link

codecov-commenter commented Mar 20, 2024

Codecov Report

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

Project coverage is 51.77%. Comparing base (dbb82be) to head (7bcb400).
Report is 23 commits behind head on master.

Files Patch % Lines
...esourceinterpreter/default/native/reflectstatus.go 0.00% 11 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4729      +/-   ##
==========================================
- Coverage   51.78%   51.77%   -0.02%     
==========================================
  Files         250      250              
  Lines       25000    24993       -7     
==========================================
- Hits        12947    12940       -7     
  Misses      11343    11343              
  Partials      710      710              
Flag Coverage Δ
unittests 51.77% <0.00%> (-0.02%) ⬇️

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.

@liangyuanpeng
Copy link
Contributor

/kind flake

@karmada-bot karmada-bot added the kind/flake Categorizes issue or PR as related to a flaky test. label Mar 20, 2024
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.

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 20, 2024
@chaosi-zju
Copy link
Member Author

the max backoff time of workqueue is 1000s @RainbowMango

// AddFlags adds flags to the specified FlagSet.
func (o *Options) AddFlags(fs *pflag.FlagSet) {
fs.DurationVar(&o.RateLimiterBaseDelay, "rate-limiter-base-delay", 5*time.Millisecond, "The base delay for rate limiter.")
fs.DurationVar(&o.RateLimiterMaxDelay, "rate-limiter-max-delay", 1000*time.Second, "The max delay for rate limiter.")
fs.IntVar(&o.RateLimiterQPS, "rate-limiter-qps", 10, "The QPS for rate limier.")
fs.IntVar(&o.RateLimiterBucketSize, "rate-limiter-bucket-size", 100, "The bucket size for rate limier.")
}

// DefaultControllerRateLimiter is a no-arg constructor for a default rate limiter for a workqueue. It has
// both overall and per-item rate limiting. The overall is a token bucket and the per-item is exponential
func DefaultControllerRateLimiter() RateLimiter {
return NewMaxOfRateLimiter(
NewItemExponentialFailureRateLimiter(5*time.Millisecond, 1000*time.Second),
// 10 qps, 100 bucket size. This is only for retry speed and its only the overall factor (not per item)
&BucketRateLimiter{Limiter: rate.NewLimiter(rate.Limit(10), 100)},
)
}

@chaunceyjiang
Copy link
Member

the max backoff time of workqueue is 1000s

The resource key should be able to re-queue infinitely many times, it's just that the maximum allowed backoff time is 1000s.

@karmada-bot karmada-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 27, 2024
@chaosi-zju chaosi-zju changed the title fix deployment replicas syncer in case aggregatedStatus of binding is "status": {} fix deployment replicas syncer in case that status.replicas haven't been collected from member cluster to template Mar 27, 2024
@chaosi-zju chaosi-zju force-pushed the hpav5 branch 2 times, most recently from 7bcb400 to cd6b82e Compare March 27, 2024 08:08
…een collected

Signed-off-by: chaosi-zju <chaosi@zju.edu.cn>
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

@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 Mar 27, 2024
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.

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 27, 2024
@karmada-bot karmada-bot merged commit ff7322a into karmada-io:master Mar 27, 2024
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/bug Categorizes issue or PR as related to a bug. kind/flake Categorizes issue or PR as related to a flaky test. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deployment propagated failed after deployment replicas syncer feature enabled
7 participants