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

cloneset ignore maxSurge when UpdateStrategyPaused=true #1324

Merged
merged 3 commits into from
Jul 5, 2023

Conversation

xiangpingjiang
Copy link
Contributor

Ⅰ. Describe what this PR does

Ⅱ. Does this pull request fix one issue?

fixes #1153

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

@kruise-bot kruise-bot added the size/S size/S 10-29 label Jun 28, 2023
Signed-off-by: pingjaing <xiangpingjiang1998@gmail.com>
Signed-off-by: pingjaing <xiangpingjiang1998@gmail.com>
@kruise-bot kruise-bot added size/M size/M: 30-99 and removed size/S size/S 10-29 labels Jul 1, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jul 1, 2023

Codecov Report

Merging #1324 (16da783) into master (6ca91fe) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@           Coverage Diff           @@
##           master    #1324   +/-   ##
=======================================
  Coverage   48.54%   48.54%           
=======================================
  Files         152      152           
  Lines       21240    21249    +9     
=======================================
+ Hits        10310    10316    +6     
- Misses       9801     9803    +2     
- Partials     1129     1130    +1     
Flag Coverage Δ
unittests 48.54% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...kg/controller/cloneset/sync/cloneset_sync_utils.go 89.15% <100.00%> (+0.19%) ⬆️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@zmberg
Copy link
Member

zmberg commented Jul 4, 2023

@xiangpingjiang And you can add the following UT:

{
			name: "[UpdateStrategyPaused=false] create 3 newRevision pods with maxSurge=3",
			set:  setUpdateStrategyPaused(createTestCloneSet(5, intstr.FromInt(0), intstr.FromInt(0), intstr.FromInt(3)), false),
			pods: []*v1.Pod{
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
			},
			expectResult: expectationDiffs{scaleUpNum: 3, scaleUpLimit: 3, useSurge: 3, updateNum: 5},
		},
		{
			name: "[UpdateStrategyPaused=true] create 0 newRevision pods with maxSurge=3",
			set:  setUpdateStrategyPaused(createTestCloneSet(5, intstr.FromInt(0), intstr.FromInt(0), intstr.FromInt(3)), true),
			pods: []*v1.Pod{
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
			},
			expectResult: expectationDiffs{updateNum: 5},
		},

@veophi
Copy link
Member

veophi commented Jul 4, 2023

@xiangpingjiang Plz add these UTs

		{
			name: "[UpdateStrategyPaused=true] create 0 newRevision pods with maxSurge=3,maxUnavailable=0",
			set:  setUpdateStrategyPaused(createTestCloneSet(5, intstr.FromInt(0), intstr.FromInt(0), intstr.FromInt(3)), true),
			pods: []*v1.Pod{
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(newRevision, appspub.LifecycleStateNormal, false, false),
				createTestPod(newRevision, appspub.LifecycleStateNormal, false, false),
				createTestPod(newRevision, appspub.LifecycleStateNormal, false, false),
			},
			expectResult: expectationDiffs{scaleDownNum: 3, scaleDownNumOldRevision: 5, updateNum: 2, updateMaxUnavailable: 3},
		},
		{
			name: "[UpdateStrategyPaused=true] create 0 newRevision pods with maxSurge=3,maxUnavailable=0",
			set:  setUpdateStrategyPaused(createTestCloneSet(5, intstr.FromInt(2), intstr.FromInt(0), intstr.FromInt(3)), true),
			pods: []*v1.Pod{
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(oldRevision, appspub.LifecycleStateNormal, true, false),
				createTestPod(newRevision, appspub.LifecycleStateNormal, false, false),
				createTestPod(newRevision, appspub.LifecycleStateNormal, false, false),
				createTestPod(newRevision, appspub.LifecycleStateNormal, false, false),
			},
			expectResult: expectationDiffs{scaleDownNum: 3, scaleDownNumOldRevision: 3},
		},

Copy link
Member

@furykerry furykerry left a comment

Choose a reason for hiding this comment

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

/lgtm

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>
@veophi
Copy link
Member

veophi commented Jul 5, 2023

/lgtm

@zmberg
Copy link
Member

zmberg commented Jul 5, 2023

/approve

@kruise-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zmberg

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

@kruise-bot kruise-bot merged commit 33c9ce1 into openkruise:master Jul 5, 2023
21 checks passed
diannaowa pushed a commit to diannaowa/kruise that referenced this pull request Aug 29, 2023
)

* cloneset ignore maxSurge when UpdateStrategyPaused=true

Signed-off-by: pingjaing <xiangpingjiang1998@gmail.com>

* add scale down  UT case for cloneSet UpdateStrategyPaused=true

Signed-off-by: pingjaing <xiangpingjiang1998@gmail.com>

* add UTs for cloneSet when UpdateStrategyPaused=true

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

---------

Signed-off-by: pingjaing <xiangpingjiang1998@gmail.com>
Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>
lilongfeng0902 pushed a commit to lilongfeng0902/kruise that referenced this pull request Sep 12, 2023
)

* cloneset ignore maxSurge when UpdateStrategyPaused=true

Signed-off-by: pingjaing <xiangpingjiang1998@gmail.com>

* add scale down  UT case for cloneSet UpdateStrategyPaused=true

Signed-off-by: pingjaing <xiangpingjiang1998@gmail.com>

* add UTs for cloneSet when UpdateStrategyPaused=true

Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>

---------

Signed-off-by: pingjaing <xiangpingjiang1998@gmail.com>
Signed-off-by: pingjiang <xiangpingjiang1998@gmail.com>
ppbits pushed a commit to ppbits/kruise that referenced this pull request Apr 4, 2024
)

* cloneset ignore maxSurge when UpdateStrategyPaused=true


* add scale down  UT case for cloneSet UpdateStrategyPaused=true


* add UTs for cloneSet when UpdateStrategyPaused=true


---------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] CloneSet UpdateStrategy Paused error
6 participants