Commit 2c1fece
* feat(e2e): multi-site agent support with --agent-count flag (#32)
- Add --agent-count flag to 'kedge dev create/delete' (default 1, preserves
existing behaviour; N>1 creates kind clusters with -1..-N suffixes)
- Extend ClusterEnv with AgentClusters []AgentClusterInfo so the e2e
framework can hand each test a kubeconfig per agent cluster
- Add RunCmd / KubectlWithConfig package-level helpers to framework/client.go
- Add test/e2e/cases/multisite.go with 6 feature builders:
TwoAgentsJoin - both agents connect, both sites Ready (PASSES)
LabelBasedScheduling - VW region selector → site-1 only
WorkloadIsolation - site-1 VW has no placement on site-2
SiteFailoverIsolation - site-1 offline, site-2 placement intact
SiteReconnect - site-1 reconnects, placement reappears
SiteListAccuracyUnderChurn - site list reflects disconnect/reconnect
- VW-scheduler tests auto-skip via requireVirtualWorkloadScheduler() probe
when the embedded-KCP scheduler is not functional (avoids cascade failures)
- Reuse authenticated client stored in context to avoid double Login in Teardown
- Register all 6 tests in standalone, external_kcp, and oidc suites
Closes #32
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* fix: apply APIResourceSchemas before APIExport to fix VW scheduler (#56)
Root cause: confighelpers.Bootstrap applied files in alphabetical order,
so apiexport-kedge.faros.sh.yaml (which references the VirtualWorkload
schema v260219-7bf8d83) was applied BEFORE
apiresourceschema-virtualworkloads.kedge.faros.sh.yaml. KCP accepted the
APIExport with an unresolvable schema reference, leaving the VirtualWorkload
API unavailable until a later reconcile. The multicluster-provider's
wildcard informer saw 'server could not find the requested resource' on
initial LIST, retried with exponential backoff, and by the time it finally
synced the e2e test's 2-minute WaitForPlacement window had expired.
Fix: sort bootstrap files by dependency tier inside createResourcesFromFS:
tier 0: apiresourceschema-* (must exist before APIExport references them)
tier 1: apiexport-* (reference tier-0 schemas)
tier 2: everything else (workspaces, etc.)
Within each tier files are applied alphabetically; the ordering is
transparent to callers of Bootstrap.
Also:
- Remove the requireVirtualWorkloadScheduler() skip probe from multisite
tests; the scheduler is expected to work now that the bootstrap is fixed.
- Add V(4) reconcile trace log to scheduler.Reconcile for future debugging.
Closes #56
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* fix: preserve site labels so VW scheduler can match them
Two bugs caused the VirtualWorkload scheduler to never produce Placements:
1. agent.registerSite() overwrote existing site labels with the agent's own
(initially-empty) label map. Any labels set via 'kedge site create
--labels' were silently wiped on the agent's first reconcile.
Fix: merge agent labels into existing labels rather than replace.
2. e2e framework launched agents without --labels, so agents had no labels
to preserve even if the merge logic were correct.
Fix: Agent.WithLabels() + pass matching labels in startMultisiteAgents.
Also adds site-label + siteSelector diagnostic logging to the scheduler
reconciler (Info level) so failures surface immediately in test runs.
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* fix(scheduler): use mcr context for cluster name + RequeueAfter 30s for site reconnect
- Use mccontext.ClusterFrom(ctx) in mapSiteToVirtualWorkloads (canonical
cluster name from multicluster-runtime context, fall back to kcp annotation)
- Add RequeueAfter: 30s so VWs are re-evaluated periodically, ensuring
placements reappear after a site reconnects even if the watch event
for the status-only Site update is missed
Fixes TestSiteReconnect failure in standalone e2e suite.
* chore: remove diagnostic logging from scheduler reconciler
Revert the temporary info-level logging added to diagnose #56.
Root cause (labels wiped by agent, and VW scheduler not triggered due to
bootstrap ordering) is now fixed and confirmed by passing e2e tests.
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* fix: add bin/ to PATH in CI so OIDC exec plugin can find kedge
The OIDC kubeconfig returned by the hub uses an exec credential plugin
(kedge get-token) instead of a static bearer token. When the test
framework runs kubectl with this kubeconfig, kubectl spawns the plugin
process -- but bin/kedge is not on PATH in the GitHub Actions runner,
causing every kubectl invocation to fail with exec-plugin-not-found.
The result: ExtractSiteKubeconfig polls for 5 minutes, never succeeds,
and all multisite tests fail with 'timed out after 5m0s waiting for
condition' in the OIDC suite.
Fix: add $(pwd)/bin to GITHUB_PATH after make build in all e2e jobs
so that the kedge binary is resolvable by the exec plugin.
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* fix: use stored OIDC client in TwoAgentsJoin assess step
In the OIDC suite, clusterEnv.HubKubeconfig is the kind admin kubeconfig
(never overwritten by kedge login, unlike the standalone suite). Creating
a KedgeClient from it points at the kind Kubernetes API which has no Sites
CRD, so WaitForSiteReady polls forever and fails after 3 minutes.
All other multisite assess functions already use ctx.Value(msClientKey{})
to get the authenticated client stored by startMultisiteAgents. Apply
the same pattern to TwoAgentsJoin.
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* fix(e2e): remove multisite tests from OIDC suite (static-token agents incompatible with Dex mode)
* fix: remove redundant UpdateStatus in registerSite
The initial UpdateStatus call used a bare Site object (no resourceVersion)
which always failed with 'metadata.resourceVersion: Invalid value: 0'.
It was also redundant: the heartbeat reporter's first sendHeartbeat()
fires immediately on start and patches status.phase=Ready via MergePatch,
which doesn't require resourceVersion.
Remove the broken call; let the reporter handle all status updates.
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
* Revert "fix(e2e): remove multisite tests from OIDC suite (static-token agents incompatible with Dex mode)"
This reverts commit 18dc324.
---------
Co-authored-by: Mangirdas Judeikis <mjudeikis@gmail.com>
Co-authored-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
Co-authored-by: mjudeikis-bot <mjudeikis-bot@users.noreply.github.com>
1 parent 30cb01f commit 2c1fece
13 files changed
Lines changed: 921 additions & 69 deletions
File tree
- .github/workflows
- pkg
- agent
- cli/cmd/dev/plugin
- hub/controllers/scheduler
- util/confighelpers
- test/e2e
- cases
- framework
- suites
- external_kcp
- oidc
- standalone
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
95 | 101 | | |
96 | 102 | | |
97 | 103 | | |
| |||
145 | 151 | | |
146 | 152 | | |
147 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
148 | 157 | | |
149 | 158 | | |
150 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
| 217 | + | |
217 | 218 | | |
218 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
219 | 225 | | |
220 | 226 | | |
221 | 227 | | |
222 | 228 | | |
223 | 229 | | |
224 | 230 | | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
| 231 | + | |
246 | 232 | | |
247 | 233 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
| |||
107 | 112 | | |
108 | 113 | | |
109 | 114 | | |
| 115 | + | |
110 | 116 | | |
111 | 117 | | |
112 | 118 | | |
| |||
137 | 143 | | |
138 | 144 | | |
139 | 145 | | |
| 146 | + | |
140 | 147 | | |
141 | 148 | | |
142 | 149 | | |
| |||
258 | 265 | | |
259 | 266 | | |
260 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
261 | 283 | | |
262 | 284 | | |
263 | 285 | | |
| |||
275 | 297 | | |
276 | 298 | | |
277 | 299 | | |
278 | | - | |
279 | | - | |
280 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
281 | 305 | | |
282 | 306 | | |
283 | 307 | | |
| |||
290 | 314 | | |
291 | 315 | | |
292 | 316 | | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
298 | 324 | | |
299 | 325 | | |
300 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
| |||
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
| 76 | + | |
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| 83 | + | |
77 | 84 | | |
78 | 85 | | |
79 | 86 | | |
| |||
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
86 | | - | |
| 93 | + | |
87 | 94 | | |
88 | 95 | | |
89 | 96 | | |
| |||
158 | 165 | | |
159 | 166 | | |
160 | 167 | | |
161 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
162 | 171 | | |
163 | 172 | | |
164 | 173 | | |
165 | 174 | | |
166 | 175 | | |
167 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
168 | 184 | | |
| 185 | + | |
169 | 186 | | |
170 | 187 | | |
171 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
78 | | - | |
| 81 | + | |
| 82 | + | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| |||
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
90 | | - | |
| 94 | + | |
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| |||
96 | 100 | | |
97 | 101 | | |
98 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
99 | 117 | | |
100 | | - | |
101 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
102 | 122 | | |
103 | 123 | | |
104 | 124 | | |
105 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
106 | 140 | | |
107 | 141 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 142 | + | |
112 | 143 | | |
113 | 144 | | |
114 | 145 | | |
| |||
117 | 148 | | |
118 | 149 | | |
119 | 150 | | |
120 | | - | |
121 | | - | |
| 151 | + | |
| 152 | + | |
122 | 153 | | |
123 | 154 | | |
124 | 155 | | |
| |||
0 commit comments