-
Notifications
You must be signed in to change notification settings - Fork 521
Allow for arbitrary Status subresource updates #179
Conversation
| ) | ||
|
|
||
| type Option interface { | ||
| ApplyOption(mdb *mdbv1.MongoDB) |
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.
@rodrigovalin this small signature change lets us not need to worry about tracking the state of a single mdb instance, as we can just modify the one that was passed to this function.
rodrigovalin
left a comment
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 think I love the idea you introduced with the different options for the status. I still think we can improve it a bit if we have another pair session. I'm mostly thinking about improving how we use GetResult
| // the resource's status is updated to reflect to the state, and any other cleanup | ||
| // operators should be performed here | ||
| func (r ReplicaSetReconciler) updateAndReturnStatusSuccess(mdb *mdbv1.MongoDB) (mdbv1.MongoDBStatus, error) { | ||
| func (r ReplicaSetReconciler) updateStatus(mdb *mdbv1.MongoDB) (reconcile.Result, error) { |
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 think this function can be removed and just move everything back to Reconcile instead!
If you look closely, this function is only doing another status.Update and simply logging more information about it, nothing else.
The Reconcile function is big enough and everyone will want to make it shorter, but we need to find a reasonable logical boundary, and not just "split it right in the middle"
rodrigovalin
left a comment
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!
All Submissions:
This PR introduces a mechanism to allow finer grained status updates.
We will now be able to update arbitrary fields of the status sub resource by creating new status options.