Commit 86d36ae
feat(app-studio): per-workspace tenant access via the GraphQL gateway (#359)
* revert(app-studio): restore /clusters/<path> tenant addressing
PR #357's bare-path change routed tenant traffic to the user's
DefaultCluster, which is NOT the selected workspace when the user is in
any non-default workspace — silently reading/writing the wrong
workspace's projects instead of erroring. Restore the original
/clusters/<tenantPath> addressing (an honest 403 from the hub proxy)
until the GraphQL migration lands proper per-workspace access.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(hub): inject X-Kedge-Cluster (tenant logical-cluster ID) for providers
The backend proxy already injects X-Kedge-Tenant (the workspace path), but
the GraphQL gateway at /graphql/clusters/{id} keys its per-cluster schema on
the logical-cluster ID, not the path. Add an optional cluster resolver that
maps the resolved tenant path to its kcp logical-cluster ID (read from the
workspace's LogicalCluster object, cached with a TTL) and inject it as
X-Kedge-Cluster. Best-effort: a resolve failure drops only this header.
Foundation for moving app-studio's tenant access onto the GraphQL gateway,
which (unlike the kcp user-proxy) is not DefaultCluster-gated. Also bumps the
gateway fork replace to the commit adding the update<Kind>Status mutation.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore: bump gateway fork to add <Plural>Yaml list query
Adds the list analogue of <Kind>Yaml so app-studio can List/Get against the
GraphQL gateway by exchanging serialized objects, without enumerating typed
field-selection sets over unstructured resources.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(app-studio): add GraphQL tenant client (gateway-backed)
App Studio's per-workspace data path: talk to the hub's embedded GraphQL
gateway at <hubBase>/graphql/<clusterID> as the caller, instead of direct kcp
access (which the hub user-proxy gates to the caller's DefaultCluster, so it
fails in non-default workspaces).
Every op exchanges whole serialized objects via the gateway's <Kind>Yaml /
<Plural>Yaml queries and applyYaml / applyStatusYaml mutations, so the client
needs no typed field-selection set over unstructured resources. GraphQL errors
are mapped onto k8s apierrors so callers' IsNotFound/IsConflict checks keep
working.
Not yet wired into the call sites — follow-up commit.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(app-studio): back asclient.Client with a ResourceClient interface
Introduce ResourceClient (the per-resource subset App Studio uses) and a
GraphQL-backed gqlResource implementing it. asclient.Client now resolves
resources through Resource(), backed by either the GraphQL tenant Scope
(production) or a dynamic client (tests) — both satisfy ResourceClient.
Also handles the core ("") API group in the GraphQL query nesting (version
sits directly on the root, no group wrapper) for Secret access.
No behavior change yet: production still constructs the dynamic path; wiring
the GraphQL path + migrating call sites follows.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(app-studio): route tenant access through the GraphQL gateway
Activate the GraphQL path: clientFor now builds a tenant.Scope from the
X-Kedge-Cluster header (the hub-injected workspace cluster ID) and the caller
token, so App Studio reaches its workspace through the hub's gateway — which
serves any workspace the caller has access to, unlike the DefaultCluster-gated
kcp user-proxy.
- http.go reads X-Kedge-Cluster into identity.clusterID
- server.go/main.go construct the GraphQL client from KEDGE_HUB_URL
- all ~18 c.Dynamic().Resource(gvr) call sites move to c.Resource(descriptor),
backed by the GraphQL Scope (prod) or a dynamic client (tests)
- tenant_resources.go holds the GraphQL descriptors (Kind/Plural) for Project,
Secret, SandboxRunner, and code-provider Connection/Repository
- isProjectAPIInitializingError recognises the gateway "schema not ready"
shapes (no schema for cluster / Project type missing) for the 503 path
Module builds, vets, and the full test suite passes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore: pin gateway fork to d10b61a (adds applyStatusYaml)
The embedded gateway must expose applyStatusYaml, which app-studio calls at
runtime for status writes. Bump the replace from a2eab00 to d10b61a so the
hub's gateway has all three primitives (update<Kind>Status, <Plural>Yaml,
applyStatusYaml).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 7eca6f3 commit 86d36ae
17 files changed
Lines changed: 718 additions & 46 deletions
File tree
- pkg/hub
- providers
- providers/app-studio
- api
- client
- tenant
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
| 330 | + | |
331 | 331 | | |
332 | 332 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| 118 | + | |
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| |||
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
153 | 166 | | |
154 | 167 | | |
155 | 168 | | |
| |||
163 | 176 | | |
164 | 177 | | |
165 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
166 | 187 | | |
167 | 188 | | |
168 | 189 | | |
| |||
188 | 209 | | |
189 | 210 | | |
190 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
191 | 220 | | |
192 | 221 | | |
193 | 222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
536 | 540 | | |
537 | 541 | | |
538 | 542 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
342 | | - | |
| 342 | + | |
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
460 | | - | |
461 | | - | |
| 460 | + | |
| 461 | + | |
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1279 | 1279 | | |
1280 | 1280 | | |
1281 | 1281 | | |
1282 | | - | |
| 1282 | + | |
1283 | 1283 | | |
1284 | 1284 | | |
1285 | 1285 | | |
| |||
1301 | 1301 | | |
1302 | 1302 | | |
1303 | 1303 | | |
1304 | | - | |
| 1304 | + | |
1305 | 1305 | | |
1306 | | - | |
| 1306 | + | |
1307 | 1307 | | |
1308 | 1308 | | |
1309 | 1309 | | |
1310 | 1310 | | |
1311 | 1311 | | |
1312 | 1312 | | |
1313 | | - | |
| 1313 | + | |
1314 | 1314 | | |
1315 | 1315 | | |
1316 | 1316 | | |
| |||
0 commit comments