-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
[test] statefulset controller: fix requests tracker concurrency #124624
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: atiratree 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 |
/triage accepted |
Can you more elaborate on why the current implementation does not work as expected? I.e. what's the underlying cause that makes the test flake? And what has changed and how it removes the flakiness? |
We set excpected failure here after 2 requests:
Then we scale up the replica set in parallel (Burst).
Then the pod tracker is called.
Each tracker method is thread safe but they are not thread safe together. This is the reason behind the flake. So we fix that by locking the increment and error checking with a single lock. Also we have the parallel requests checking which is independent and used in TestParallelScale test.
This was guarded by a lock before and maxParallel was always equal to the number of requests. So it didn't test the parallelness correctly and had to be fixed as well. |
desc string | ||
replicas int32 | ||
desiredReplicas int32 | ||
expectedMinParallelRequests int |
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.
expectedMinParallelRequests
is a new field? Why the original 1
is not enough?
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 have moved this refactoring to a new commit: 7b725f3.
This is to make the test more accurate as originally we expected only 2 parallel requests. But if we create a 1000 pods we should expect more, otherwise it would suggest a regression.
@@ -3017,8 +3015,8 @@ func parallelScale(t *testing.T, set *apps.StatefulSet, replicas, desiredReplica | |||
t.Errorf("Failed to scale statefulset to %v replicas, got %v replicas", desiredReplicas, set.Status.Replicas) | |||
} | |||
|
|||
if (diff < -1 || diff > 1) && om.createPodTracker.maxParallel <= 1 { | |||
t.Errorf("want max parallel requests > 1, got %v", om.createPodTracker.maxParallel) | |||
if om.createPodTracker.maxParallelRequests < expectedMinParallelRequests { |
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.
Why is (diff < -1 || diff > 1)
no longer tested?
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.
this was replaced by the expectedMinParallelRequests
as the test case above can specify the expected number of requests for a diff they expect
Worth mentioning:
|
I have solved this by requiring the enablement for the tracking so it should not affect the other tests now, apart from the I have also added a check for the expectedMinParallelRequests values. |
we can test for larger number of parallel requests than 2 in statefulsets with hundreds of replicas
/lgtm |
LGTM label has been added. Git tree hash: 9efa79f0eea8c3b1ddaaa63a3763993f5280d538
|
What type of PR is this?
/kind bug
/kind flake
What this PR does / why we need it:
fixes a flake when using Parallel PodManagementPolicy (burst) in StatefulSets
Which issue(s) this PR fixes:
Fixes #124526
Special notes for your reviewer:
tested with the stress tool
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: