feat: continuous re-registration reconciliation (#5)#24
Merged
Conversation
Extend registration reconciliation from one-shot bootstrap to continuous drift recovery: a converged cluster now reschedules a periodic resync so a registration a pod loses (rescheduled onto a fresh node, wiped storage) is re-issued without human action. A lost registration on a still-running pod produces no watch event, so this resync is the mechanism that detects drift. The planner already computed full-diff semantics; the gap was the controller returning no requeue once converged. Add a resyncInterval and requeue on it from the converged branch. Tests: - planner: multiple lost registrations re-issued without a second MAIN - controller envtest: re-register a lost data instance (MAIN untouched), re-add a lost coordinator, no-op across repeated resyncs - e2e: wipe a data instance's registration on the leader, assert the operator converges the cluster back to fully registered
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.
What
Implements
specs/operator-mvp/issues/05-continuous-re-registration.md: the operator's reason to exist over the chart's one-shot setup Job. Registration state a pod loses (rescheduled onto a fresh node, wiped storage) is now restored automatically.The gap this closes
The registration planner already computed full-diff semantics (from #3). The missing piece was on the controller side: a converged reconcile returned
ctrl.Result{}with no requeue. A registration lost on a still-running pod produces no watch event — its StatefulSet is unchanged — so the drift would never be detected. Reconciliation was effectively one-shot.This adds a
resyncInterval(30s) and requeues on it from the converged branch, so a converged cluster is continuously re-observed and drift is re-issued without human action. Leadership stays hands-off: the planner never emits a MAIN promotion when a MAIN already exists.Changes
internal/controller/memgraphcluster_controller.go): periodic resync from the converged branch; docstring updated to describe continuous (not one-shot) reconciliation.Tests
internal/planner/planner_test.go): multiple lost registrations re-issued without a second MAIN (adds the "multiple lost" case; single-lost, converged-no-op, and recovery-with-MAIN-present were already covered).internal/controller/memgraphcluster_controller_test.go): re-register a lost data instance leaving MAIN untouched; re-add a lost coordinator; no-op across repeated resyncs (each reschedules the resync). Updated the bootstrap spec's converged assertion to expect the resync requeue.test/e2e/memgraphcluster_test.go): unregister a data instance on the coordinator leader, confirm it left the view, then assert the operator converges the cluster back to fully registered. Factored the converged-state check into a sharedverifyClusterRegistered.Acceptance criteria
Verification
make test-unit, controller envtest (go test ./internal/controller/...), andmake lintall green locally. E2E runs in CI against the licensed KinD cluster.