chore: refactor the status/condition updating into an interface with functions#73
Merged
chore: refactor the status/condition updating into an interface with functions#73
Conversation
Pull Request Test Coverage Report for Build 3699328265
💛 - Coveralls |
2b1d1cf to
e68e52e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change begins refactoring the reconciler code. The existing reconciler code makes heavy use of embedded structs to mimic an inheritance model. Go doesn't have an inheritance model, and generally discourages this in favor of interfaces.
This code moves the
updateStatus,updateCondition,setReadyStatusandrefetchmethods out of theBaseReconciler{}struct and into their own packages where they are pure functions. These functions work by checking that the objects passed in match thehasStatusReconcilerinterface.The ultimate goal is to create generic
RequestReconcilerandTemplateReconcilercontrollers that can be configured dynamically on startup to decide which custom resources they are monitoring for, and whichIBuilderis used for them. This pattern will make it simpler to add in our own custom controllers in the future, or even support a pluggable controller model.Note: The naming of
hasStatusReconcileris ugly - but it's a private interface so we can refactor it any time once we have a better name.