-
Notifications
You must be signed in to change notification settings - Fork 22
WIP Helper pattern #537
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
WIP Helper pattern #537
Conversation
MCK 1.6.0 Release NotesNew Features
Bug Fixes
|
// readState abstract reading the state of the resource that we store on the cluster between reconciliations. | ||
func (h *ReplicaSetReconcilerHelper) readState() (*ReplicaSetDeploymentState, error) { | ||
// Try to get the last achieved spec from annotations and store it in state | ||
if lastAchievedSpec, err := h.resource.GetLastSpec(); err != 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.
this should probably one-off migration 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.
For now it's not a migration, I just abstracted the state reading/writing in a separate function (instead of randomly accessing annotations during the reconcile)
It will make more sense with a more complex state. I may even use the state_store at that point
|
||
// Reconcile reads that state of the cluster for a MongoDbReplicaSet object and makes changes based on the state read | ||
// and what is in the MongoDbReplicaSet.Spec | ||
func (r *ReconcileMongoDbReplicaSet) Reconcile(ctx context.Context, request reconcile.Request) (res reconcile.Result, e 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.
consider putting real controller in one file and the helper in another mongodbreplicaset_reconciler_helper to separate clearly what's being executed in real Reconcile even, and what as part of the helper
Closed in favor of #544 |
Summary
Proof of Work
Checklist
skip-changelog
label if not needed