refactor(cluster-handler): implement Server-Side Apply for all controllers#123
Merged
fernando-villalba merged 1 commit intomainfrom Jan 17, 2026
Merged
refactor(cluster-handler): implement Server-Side Apply for all controllers#123fernando-villalba merged 1 commit intomainfrom
fernando-villalba merged 1 commit intomainfrom
Conversation
…llers Refactors `MultigresCluster` and TableGroup controllers to use Server-Side Apply (SSA) for resource management, replacing the legacy Get/Create/Update pattern. Changes: - Replaced client.Create/Update calls with `client.Patch(..., client.Apply)` in `reconcile_global`, `reconcile_cells`, `reconcile_databases`, and `tablegroup_controller`. - Standardized FieldOwner to "multigres-operator" for clear ownership. - Removed unnecessary `Get` checks and "IsNew" logic, simplifying the reconciliation loop. - Standardized eventing to emit "Applied" for all successful operations, removing ambiguous "Created"/"Updated" distinction. - Added safety check for `EventRecorder` in `tablegroup_controller` to prevent panics in test environments. - Updated unit and integration tests to reflect SSA behavior and removed obsolete test cases (e.g., Get failures). Benefits: - Atomicity: Reduces race conditions by handling creation and updates in a single atomic operation. - Efficiency: Reduces API server round-trips by removing read-before-write checks. - Robustness: Simplifies error handling and conflict resolution. - 100% Test Coverage maintained across the module.
🔬 Go Test Coverage ReportSummary
Status✅ PASS DetailShow New Coverage |
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.
Refactors
MultigresClusterand TableGroup controllers to use Server-Side Apply (SSA) for resource management, replacing the legacy Get/Create/Update pattern.Changes:
client.Patch(..., client.Apply)inreconcile_global,reconcile_cells,reconcile_databases, andtablegroup_controller.Getchecks and "IsNew" logic, simplifying the reconciliation loop.EventRecorderintablegroup_controllerto prevent panics in test environments.Benefits: