-
Notifications
You must be signed in to change notification settings - Fork 22
CNF-23239: controller: nrop: per-tree processing and progress #3998
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?
Changes from all commits
82314e3
a49b057
4ea4bf5
ef65aeb
1b8da71
b0e9726
670c1f4
8196535
fbf55d6
d9f5453
3b9b5b5
ef94726
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -43,6 +43,16 @@ func (rs Step) EarlyStop() bool { | |||||||||||||||||
| return rs.ConditionInfo.Type != status.ConditionAvailable | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| // Ongoing returns true if the reconciliation is still ongoing/progressing | ||||||||||||||||||
| func (rs Step) Ongoing() bool { | ||||||||||||||||||
| return rs.Result.RequeueAfter > 0 | ||||||||||||||||||
| } | ||||||||||||||||||
|
Comment on lines
+46
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
At Line 48, Suggested fix func (rs Step) Ongoing() bool {
- return rs.Result.RequeueAfter > 0
+ return rs.ConditionInfo.Type == status.ConditionProgressing && rs.Error == nil
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
|
|
||||||||||||||||||
| // Failed returns true if the reconciliation was not succesfull | ||||||||||||||||||
| func (rs Step) Failed() bool { | ||||||||||||||||||
| return rs.Error != nil | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| // WithReason set the existing reason with the given value, | ||||||||||||||||||
| // if not set already and returns a new updated Step | ||||||||||||||||||
| func (rs Step) WithReason(reason string) Step { | ||||||||||||||||||
|
|
@@ -63,6 +73,15 @@ func (rs Step) WithMessage(message string) Step { | |||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| // UpdateMessage overrides the message, prepending to any existing one, and returns a new updated Step | ||||||||||||||||||
| func (rs Step) UpdateMessage(message string) Step { | ||||||||||||||||||
| return Step{ | ||||||||||||||||||
| Result: rs.Result, | ||||||||||||||||||
| ConditionInfo: rs.ConditionInfo.UpdateMessage(message), | ||||||||||||||||||
| Error: rs.Error, | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| // StepSuccess returns a Step which tells the caller | ||||||||||||||||||
| // the reconciliation attempt was completed successfully | ||||||||||||||||||
| func StepSuccess() Step { | ||||||||||||||||||
|
|
||||||||||||||||||
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.
Assert the pending tree is still blocked in the first reconcile
This test currently proves only the positive path (ready tree DS exists, Progressing=true). It does not assert that the pending tree DS is still absent and Available is false at that point, so a regression to eager DS creation could still pass.
Suggested test hardening
By("Verify pool2 DaemonSet exists even though pool1 is still pending") ds := &appsv1.DaemonSet{} mcp2DSKey := client.ObjectKey{ Name: objectnames.GetComponentName(nro.Name, mcp2.Name), Namespace: testNamespace, } Expect(reconciler.Client.Get(ctx, mcp2DSKey, ds)).To(Succeed()) + + By("Verify pool1 DaemonSet is not created yet") + mcp1DSKeyPending := client.ObjectKey{ + Name: objectnames.GetComponentName(nro.Name, mcp1.Name), + Namespace: testNamespace, + } + err = reconciler.Client.Get(ctx, mcp1DSKeyPending, &appsv1.DaemonSet{}) + Expect(apierrors.IsNotFound(err)).To(BeTrue(), "pool1 daemonset should still be pending") By("Verify global status is Progressing, not Available") Expect(reconciler.Client.Get(ctx, client.ObjectKeyFromObject(nro), nro)).To(Succeed()) progressingCond := getConditionByType(nro.Status.Conditions, status.ConditionProgressing) Expect(progressingCond).ToNot(BeNil()) Expect(progressingCond.Status).To(Equal(metav1.ConditionTrue)) + availableCond := getConditionByType(nro.Status.Conditions, status.ConditionAvailable) + Expect(availableCond).ToNot(BeNil()) + Expect(availableCond.Status).To(Equal(metav1.ConditionFalse))📝 Committable suggestion
🤖 Prompt for AI Agents