-
Notifications
You must be signed in to change notification settings - Fork 71
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
Rewrite workload control flow of BatchRelease controller #90
Conversation
Codecov Report
@@ Coverage Diff @@
## master #90 +/- ##
===========================================
+ Coverage 21.86% 32.93% +11.06%
===========================================
Files 38 38
Lines 4120 3486 -634
===========================================
+ Hits 901 1148 +247
+ Misses 3056 2133 -923
- Partials 163 205 +42
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
pkg/controller/batchrelease/batchrelease_special_cases_handler.go
Outdated
Show resolved
Hide resolved
@@ -65,7 +66,7 @@ func (r *Executor) syncStatusBeforeExecuting(release *v1alpha1.BatchRelease, new | |||
// handle the case that release plan is changed during progressing | |||
reason = "PlanChanged" | |||
message = "release plan is changed, then recalculate status" | |||
signalRecalculate(release, newStatus) | |||
utils.SignalRecalculate(release, newStatus) | |||
|
|||
case isPlanUnhealthy(release): |
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.
What means is unhealthy? What scenarios can lead to unhealthy and how to get back to normal?
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.
What means is unhealthy?
- currentStepIndex > len(steps).
In this scene, we will try to restart from beginning.
klog.InfoS("using statefulset-like batch release controller for this batch release", "workload name", targetKey.Name, "namespace", targetKey.Namespace) | ||
return workloads.NewUnifiedWorkloadRolloutControlPlane(workloads.NewStatefulSetLikeController, r.client, r.recorder, release, newStatus, targetKey, gvk), nil | ||
return batchstyle.NewControlPlane(statefulset.NewController, r.client, r.recorder, release, newStatus, targetKey, gvk), nil | ||
} | ||
|
||
func (r *Executor) moveToNextBatch(release *v1alpha1.BatchRelease, status *v1alpha1.BatchReleaseStatus) bool { |
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.
To simplify the logic, i think when batchPartition is nil, do not execute any batch.
@@ -124,38 +123,38 @@ func (r *Executor) executeBatchReleasePlan(release *v1alpha1.BatchRelease, newSt | |||
switch { |
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.
When progressDone is true, i think it do not come into Finalizing, but rather just to Completed. Finalizing State feel like it can be removed.
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.
Finalizing state cannot be skipped.
Finalizing state will delete some resources/annotations and restore some configuration for workloads.
pkg/controller/batchrelease/control/batchstyle/cloneset/control.go
Outdated
Show resolved
Hide resolved
pkg/controller/batchrelease/batchrelease_special_cases_handler.go
Outdated
Show resolved
Hide resolved
pkg/controller/batchrelease/control/partitionstyle/statefulset/control_test.go
Outdated
Show resolved
Hide resolved
pkg/controller/batchrelease/control/partitionstyle/statefulset/control_test.go
Outdated
Show resolved
Hide resolved
pkg/controller/batchrelease/control/partitionstyle/statefulset/control.go
Outdated
Show resolved
Hide resolved
pkg/controller/batchrelease/control/partitionstyle/cloneset/control.go
Outdated
Show resolved
Hide resolved
pkg/controller/batchrelease/control/partitionstyle/statefulset/control_test.go
Outdated
Show resolved
Hide resolved
pkg/controller/batchrelease/control/partitionstyle/statefulset/control_test.go
Outdated
Show resolved
Hide resolved
pkg/controller/batchrelease/control/partitionstyle/control_plane.go
Outdated
Show resolved
Hide resolved
pkg/controller/batchrelease/control/canarystyle/deployment/canary.go
Outdated
Show resolved
Hide resolved
pkg/controller/batchrelease/control/canarystyle/control_plane.go
Outdated
Show resolved
Hide resolved
20c7728
to
3411a4d
Compare
aec049b
to
2dbe53d
Compare
api/v1alpha1/batchrelease_types.go
Outdated
@@ -48,6 +48,7 @@ type BatchReleaseSpec struct { | |||
// default is false | |||
// +optional | |||
Paused bool `json:"paused,omitempty"` | |||
Cancel bool `json:"cancel,omitempty"` |
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.
Please add comments for Cancel.
63ef2df
to
b1be12f
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.
/lgtm
Signed-off-by: mingzhou.swx <[email protected]>
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.
/lgtm
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: furykerry 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 |
Signed-off-by: mingzhou.swx [email protected]
Ⅰ. Describe what this PR does
Rewrite workload control flow of BatchRelease controller
Improve unit test of BatchRelease controller