Skip to content

refactor(multigrescluster): split controller, fix deletion, and update API#112

Merged
fernando-villalba merged 2 commits intomainfrom
fix/controller-deletion-and-refactor
Jan 6, 2026
Merged

refactor(multigrescluster): split controller, fix deletion, and update API#112
fernando-villalba merged 2 commits intomainfrom
fix/controller-deletion-and-refactor

Conversation

@fernando-villalba
Copy link
Collaborator

Refactors the MultigresCluster controller for better maintainability and fixes critical issues with deletion and default resolution.

Key Changes:

  • Controller Refactor: Split the monolithic MultigresCluster controller into logical files (reconcile_global.go, reconcile_cells.go, reconcile_databases.go, status.go).
  • Active Deletion: Implemented "Active Deletion" logic in checkChildrenDeleted. The controller now explicitly deletes child resources (Cells, TableGroups) instead of relying solely on Garbage Collection. This fixes hanging tests in envtest environments.
  • Smart Defaulting Fix: Updated PopulateClusterDefaults in the Resolver to propagate the Cluster's Cells to the default Shard's MultiOrch spec. This resolves the "MultiOrch has no cells" error in minimal configurations.
  • API Update: Changed GlobalTopoServer and MultiAdmin fields in MultigresClusterSpec to pointers. This allows proper detection of "missing" vs "empty" fields for lazy configuration.
  • Tests: Split unit and integration tests into focused files matching the controller structure. Updated test expectations to align with the new active deletion error messages and default injection logic.
  • Build: Updated Makefile to use kubectl apply --server-side for installing CRDs to avoid size limit issues.

…e API

Refactors the MultigresCluster controller for better maintainability and fixes critical issues with deletion and default resolution.

Key Changes:
- **Controller Refactor:** Split the monolithic `MultigresCluster` controller into logical files (`reconcile_global.go`, `reconcile_cells.go`, `reconcile_databases.go`, `status.go`).
- **Active Deletion:** Implemented "Active Deletion" logic in `checkChildrenDeleted`. The controller now explicitly deletes child resources (`Cells`, `TableGroups`) instead of relying solely on Garbage Collection. This fixes hanging tests in `envtest` environments.
- **Smart Defaulting Fix:** Updated `PopulateClusterDefaults` in the Resolver to propagate the Cluster's `Cells` to the default Shard's `MultiOrch` spec. This resolves the "MultiOrch has no cells" error in minimal configurations.
- **API Update:** Changed `GlobalTopoServer` and `MultiAdmin` fields in `MultigresClusterSpec` to pointers. This allows proper detection of "missing" vs "empty" fields for lazy configuration.
- **Tests:** Split unit and integration tests into focused files matching the controller structure. Updated test expectations to align with the new active deletion error messages and default injection logic.
- **Build:** Updated `Makefile` to use `kubectl apply --server-side` for installing CRDs to avoid size limit issues.
@github-actions

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

🔬 Go Test Coverage Report

Summary

Coverage Type Result
Threshold 0%
Previous Test Coverage Unknown%
New Test Coverage Unknown%

Status

⚠️ SKIPPED (Build Failed?)

Detail

Show New Coverage
No coverage report generated (Build likely failed).

@fernando-villalba fernando-villalba merged commit cde0544 into main Jan 6, 2026
1 of 3 checks passed
@fernando-villalba fernando-villalba deleted the fix/controller-deletion-and-refactor branch January 6, 2026 17:41
@fernando-villalba
Copy link
Collaborator Author

Merging this to fix some critical issues on the cluster handler, resolver and also update the API so that the linter can pass on CI.

The test coverage is currently 100%. Also additional smoke testing and integration testing was done to verify proper functionality.

I will do another PR straight after this one to ensure the go module references point to the correct API version and we don't get the linter issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant