You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/review-plan.md
+94-22Lines changed: 94 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Overview
4
4
5
-
Review of the rewrite replacing `galactic-agent` with `galactic-router`. The changes remove ~1527 lines (agent, bootstrap, gobgp provider/server) and add ~860 lines (router, controllers, reconcile, runtime, model, hash, metrics). The code has significant issues that must be resolved before it can be committed.
5
+
Review of the rewrite replacing `galactic-agent` with `galactic-router`. The changes remove ~1755 lines (agent, bootstrap, gobgp provider/server) and add ~3643 lines (router, controllers, reconcile, runtime, model, hash, frr). All original issues have been resolved; new test files have been added on this branch.
**Verification:**`go build ./...` should still succeed.
55
55
56
-
### 3.2 Delete unused condition constants from `status.go`
56
+
**Status: DONE** — `internal/metrics/` directory no longer exists.
57
+
58
+
~~### 3.2 Delete unused condition constants from `status.go`~~
57
59
58
60
**File:**`internal/controller/status.go`
59
61
@@ -77,9 +79,9 @@ The helper variables `fsmConditions` and `fsmStateToCondition` are also dead cod
77
79
78
80
**Verification:**`go vet ./internal/controller/` should show no unused imports.
79
81
80
-
**Status: DONE** — removed in cosmos API v3 migration; `setPeerReadyCondition` now sets a single `Ready` condition using `bgpv1alpha1.ConditionTypeReady`.
82
+
**Status: DONE** — removed in cosmos API v3 migration; `setPeerReadyCondition` now sets a single `Ready` condition using `bgpv1alpha1.ConditionTypeReady`. The status.go file now only defines the used condition constants and `Reason*` strings.
81
83
82
-
### 3.3 Fix `ConditionSessionOpenCfm` typo
84
+
~~### 3.3 Fix `ConditionSessionOpenCfm` typo~~
83
85
84
86
**File:**`internal/controller/status.go`
85
87
@@ -93,7 +95,7 @@ The helper variables `fsmConditions` and `fsmStateToCondition` are also dead cod
93
95
94
96
## Phase 4: Fix EVPN Stub (P1)
95
97
96
-
### 4.1 Replace `buildEVPNPath` stub with proper error or implementation
98
+
~~### 4.1 Replace `buildEVPNPath` stub with proper error or implementation~~
97
99
98
100
**File:**`internal/runtime/gobgp/paths.go`
99
101
@@ -105,11 +107,13 @@ The helper variables `fsmConditions` and `fsmStateToCondition` are also dead cod
105
107
106
108
**Verification:** After short-term fix, `go test ./internal/runtime/gobgp/` should pass. After long-term fix, EVPN advertisements should appear in GoBGP state.
107
109
110
+
**Status: DONE** — full EVPN Type 5 IP Prefix path construction implemented in `buildEVPNPaths` (commit `243f37e`). Builds Type 1 RD from router-ID, parses route target communities, constructs MpReachNLRI with EVPN NLRI, and applies via `AddPath`/`DeletePath`.
111
+
108
112
---
109
113
110
114
## Phase 5: Improve Controller Efficiency (P2)
111
115
112
-
### 5.1 Add field index for BGPRouter targetRef.name
116
+
~~### 5.1 Add field index for BGPRouter targetRef.name~~
@@ -138,11 +144,13 @@ Both controllers should call this helper instead of duplicating the logic.
138
144
139
145
**Verification:** Both controllers should behave identically after the refactor. `go vet` should show no issues.
140
146
147
+
**Status: DONE** — `internal/controller/routing.go` contains `enqueueRoutersForTarget` with a `resource` parameter for log context. Both `bgppeer_controller.go` (line 43) and `bgppolicy_controller.go` (line 44) call it.
148
+
141
149
---
142
150
143
151
## Phase 6: Fix Error Messages (P2)
144
152
145
-
### 6.1 Return error from `resolveNodeIPv6` when nextHop is empty + EVPN ads present
153
+
~~### 6.1 Return error from `resolveNodeIPv6` when nextHop is empty + EVPN ads present~~
146
154
147
155
**File:** `internal/reconcile/reconcile.go`
148
156
@@ -152,19 +160,23 @@ Both controllers should call this helper instead of duplicating the logic.
152
160
153
161
**Verification:** A node without IPv6 should get a clear error in the BGPRouter status, not a misleading "MissingRouteDistinguisher".
154
162
163
+
**Status: DONE** — `BuildDesiredRouter` checks `nextHop == ""` with EVPN advertisements and returns `"node %s has no IPv6 InternalIP; EVPN advertisements require it"` (lines 91–94).
@@ -186,17 +200,75 @@ Both controllers should call this helper instead of duplicating the logic.
186
200
187
201
**Verification:** Restart the router pod — the hash should be restored from status and no-op reconciles should be skipped.
188
202
203
+
**Status: DONE** — hash persisted as annotation `galactic.datum.net/config-hash` (line 31). Reconciler compares new hash against annotation before applying (line 125).
204
+
205
+
---
206
+
207
+
## Phase 8: New Tests (P1) — Review Required
208
+
209
+
Three new test files were added on this branch but are not yet committed. They should be reviewed and committed.
- `fakeCache` / `fakeManager` — minimal controller-runtime interfaces for testing
215
+
- `TestRegisterIndexes` — verifies all 5 indexes register without error
216
+
- `TestRegisterIndexes_indexFunctions` — verifies each index function returns correct values (BGPPeer by secret, BGPPeer by router, BGPPolicy by router, BGPAdv by router, BGPRouter by target)
217
+
- `TestEnqueueRoutersForTarget_*` — 5 tests covering routerRef, routerSelector, both nil, no match, routerRef overrides selector
218
+
- `TestNodeToRouterRequests_*` — 4 tests covering no match, single router, multiple routers, cross-namespace scoping, invalid object, list error
219
+
- `TestSetRouterPhase_*` — 3 tests for Ready/Failed/Pending phases
220
+
- `TestSetPeerReadyCondition` — 8 test cases covering all FSM states (Established, OpenConfirm, OpenSent, Active, Connect, Idle with reasons, unknown)
221
+
- `TestSetAdvertisementCondition_*` — 2 tests for True/False conditions
222
+
- `TestSetPolicyCondition_*` — 2 tests for True/False conditions
223
+
224
+
**Review notes:**
225
+
- Test coverage is comprehensive. The `fakeCache`/`fakeManager` stubs are minimal but sufficient for the tested functions.
226
+
- The `fakeCache.IndexField` implementation keys by `fmt.Sprintf("%T/%s", obj, field)` to avoid collisions between types that share field names (e.g., BGPPeer, BGPPolicy, BGPAdvertisement all use `.spec.routerRef.name`).
0 commit comments