Commit cde0544
authored
Merge pull request #112 from numtide/fix/controller-deletion-and-refactor
refactor(multigrescluster): split controller, fix deletion, and update 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.File tree
26 files changed
+2746
-1417
lines changed- api/v1alpha1
- config
- crd/bases
- manager
- pkg
- cluster-handler
- controller
- multigrescluster
- tablegroup
- resolver
26 files changed
+2746
-1417
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
381 | | - | |
| 381 | + | |
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
| 390 | + | |
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| |||
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
423 | | - | |
| 423 | + | |
424 | 424 | | |
425 | 425 | | |
426 | | - | |
| 426 | + | |
427 | 427 | | |
428 | | - | |
| 428 | + | |
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
| 242 | + | |
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6866 | 6866 | | |
6867 | 6867 | | |
6868 | 6868 | | |
6869 | | - | |
| 6869 | + | |
| 6870 | + | |
6870 | 6871 | | |
6871 | 6872 | | |
6872 | 6873 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
0 commit comments