-
Notifications
You must be signed in to change notification settings - Fork 21
feat: add stopping stage update run implementation #374
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
base: main
Are you sure you want to change the base?
Conversation
040bf28 to
878fa65
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
878fa65 to
723e9c9
Compare
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
723e9c9 to
4bee175
Compare
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
| validateUpdateRunMetricsEmitted(wantMetrics...) | ||
| }) | ||
|
|
||
| It("Should delete all the clusterResourceBindings in the delete stage and complete the update run", func() { |
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 we add a case where we stop in between the deletion stage ?
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 tried previously and we have no control over the clusters in the stage so the stop timing here is difficult.
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.
We can add a finalizer on the bindings so that they are not deleted.
| validateUpdateRunMetricsEmitted(wantMetrics...) | ||
| }) | ||
|
|
||
| It("Should wait for cluster to finish updating before update run is completely stopped", func() { |
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 "It" section is redundant unless you want to check updateRun is in stopping state CONSISTENTLY.
| validateUpdateRunMetricsEmitted(wantMetrics...) | ||
| }) | ||
|
|
||
| It("Should delete all the clusterResourceBindings in the delete stage and complete the update run", func() { |
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.
We can add a finalizer on the bindings so that they are not deleted.
| "github.com/kubefleet-dev/kubefleet/pkg/utils/condition" | ||
| ) | ||
|
|
||
| var _ = Describe("UpdateRun stop tests", func() { |
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.
Not a blocker to this PR, but this test is too complicated, including many unnecessary tests for stopping. If we can create a small number of updating/deleting clusters and a simpler strategy to just test the stop cases, that's better. We actually have one https://github.com/kubefleet-dev/kubefleet/blob/main/pkg/controllers/updaterun/controller_integration_test.go#L473C1-L490C2 This one does not have any to-be-deleted bindings though. Please feel free to add if you want to update.
|
Will address any unresolved stop integration test specific comments in a follow up PR. Current integration test and UTs should have major coverage. |
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
0ac9549 to
eb10bb3
Compare
| } | ||
| } | ||
|
|
||
| if allDeletingClustersDeleted || len(toBeDeletedBindings) == 0 { |
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.
Do we need to check if len(toBeDeletedBindings), if len(toBeDeletedBindings) == 0 wouldn't allDeletingClustersDeleted be true ?
| tt.updateRun.Status.StagesStatus[0].Conditions, | ||
| string(placementv1beta1.StageUpdatingConditionProgressing), | ||
| ) | ||
| if progressingCond == nil { |
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.
cmp.Diff can handle nil values passed to it
| }, | ||
| }, | ||
| }, | ||
| UpdateStrategySnapshot: &placementv1beta1.UpdateStrategySpec{ |
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.
nit: do we need UpdateStrategySnapshot for this UT ?
| } | ||
|
|
||
| // Check error expectations. | ||
| if tt.wantError { |
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.
Lets check the error similar to TestStopUpdatingStage, i.e. check the error msg instead of checking to see if error is errStagedUpdatedAborted, if we construct the wantErr correctly we don't need to use errors.Is ?
Description of your changes
I have:
Added a check to make sure no cluster start updating and let currently updating cluster finish within a stage before marking the stage and update run as stopped.
Update the stage condition status as stopping or stopped.
Update integration tests and added UTs.
Run
make reviewableto ensure this PR is ready for review.How has this code been tested
Special notes for your reviewer
While waiting for cluster to finish updating, stage and update run will have a progressing unknown condition with the reason as stopping.