-
Notifications
You must be signed in to change notification settings - Fork 172
Compute NumPropagatedObjects in HNCConfiguration status #542
Compute NumPropagatedObjects in HNCConfiguration status #542
Conversation
/assign @adrianludwin |
8bc9af3
to
ec26995
Compare
Note: This PR is implemented on top of kubernetes-retired#542, please review that first. I will rebase and remove the hold once kubernetes-retired#542 is merged. Thank you! This PR computes NumSourceObjects as a part of HNCConfiguration status. NumSourceObjects indicates the number of objects of a specific type created by users. Tested:unit tests, GKE cluster Issue: kubernetes-retired#411 initial commit
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.
Nice! Circling back to review the tests now but I wanted to send you what I already had.
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.
Eh, now I see the downside to putting the Sleep at the beginning of the Reconciler - it means that the regular business logic (e.g. adding/removing types) is also delayed by 3s. I'm not sure we want that. Sorry I missed that.
How about we write some logic to intercept the calls from the object reconcilers and make sure we only trigger one reconciliation every N seconds? That way, most of the reconciler will still work ASAP. You'll have to write the deduping logic yourself but that should be pretty simple. Talk to Yiqi about how to trigger a periodic event using a long-running goroutine. It'll look something like this in the Setup function:
go func() {
for { // have some kind of way to break the loop when the controller exits
time.Sleep(3 * time.Second) // use constant instead
if r.objCountChanged {
r.objCountChanged = false
r.enqueueReconcile()
}
}
}()
ec26995
to
8d052a3
Compare
Thanks for the suggestion! I will resolve the comments about tests later after I change to this method. Hopefully it won't take that long after. |
46bea33
to
f13a919
Compare
Thanks so much for the review. I updated the code and replied to all your comments. Feel free to take a look! Thank you! |
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.
Sorry for the terse comments, just trying to get this back to you ASAP. Almost ready to go, just a few last comments
This PR computes NumPropagatedObjects as a part of HNCConfiguration status. NumPropagatedObjects indicates the number of propagated objects of a specific type created by HNC. Tested: unit tests, GKE cluster Issue: kubernetes-retired#411
f13a919
to
1591a2d
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
/approve
/assign @rjbez17
/hold
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adrianludwin, rjbez17, sophieliu15 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 |
This PR computes NumPropagatedObjects as a part of HNCConfiguration status. NumPropagatedObjects indicates the number of propagated objects of a specific type created by HNC.
Tested:unit tests, GKE cluster
Issue: #411