Commit 97051d8
Add MCPServerEntry backend discovery to VirtualMCPServer (#4698)
* Add MCPServerEntry backend discovery to VirtualMCPServer controller
VirtualMCPServer needs to discover MCPServerEntry resources (zero-infrastructure
catalog entries) and include them as backends. This enables vMCP to route traffic
to remote MCP servers declared as MCPServerEntry without proxy pods.
- Add WorkloadTypeMCPServerEntry constant and discoverer logic that lists
MCPServerEntries by groupRef, converts them to vmcp.Backend using the remote
URL directly from the spec (no K8s Service needed)
- Extend ConfigMap generation to include entry-type backends with remoteURL,
transport, auth config, and CA bundle mount paths
- Mount CA bundle ConfigMaps as read-only volumes at
/etc/toolhive/ca-bundles/<entry-name>/ when caBundleRef is configured
- Add mcpserverentries to VirtualMCPServer RBAC rules (get/list/watch)
- Add MCPServerEntry watch with optimized mapper (via MCPGroup Status.Entries)
- Add CABundlePath field to StaticBackendConfig for TLS verification
- Fix pre-existing missing mcpremoteproxies RBAC marker on controller
- Extract metadata key constants to fix goconst lint violations
Closes #4657
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Regenerate CRD manifests and API docs for CABundlePath field
Run task operator-manifests, operator-generate, and crdref-gen to
pick up the new CABundlePath field on StaticBackendConfig and the
updated RBAC markers.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Address review feedback for MCPServerEntry discovery
- Rename metadataKeyWorkloadStat to metadataKeyWorkloadStatus (F4)
- Add nil guard to caBundleMountPath for defensive safety (F5)
- Fix volume name truncation with hash suffix to avoid collisions and
trailing hyphens in DNS labels (F2)
- Add url.Parse validation for RemoteURL as defense-in-depth (F6)
- Propagate errors from buildCABundlePathMap and
buildCABundleVolumesForEntries instead of silently swallowing (F7)
- Add explicit phase check to skip non-Valid MCPServerEntry backends
- Use path.Join instead of fmt.Sprintf for path construction
- Add tests for volume name truncation, collision avoidance, and
phase-based filtering
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix undefined assert.NotHasSuffix in volume name tests
testify does not provide NotHasSuffix; use
assert.False with strings.HasSuffix instead.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix import-shadowing lint errors in k8s workload backends
Rename local `url` variables to `serverURL` and `proxyURL` to avoid
shadowing the `net/url` import, which revive flags as import-shadowing.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent d3479a9 commit 97051d8
13 files changed
Lines changed: 1813 additions & 27 deletions
File tree
- cmd/thv-operator/controllers
- deploy/charts/operator-crds
- files/crds
- templates
- docs/operator
- pkg/vmcp
- config
- workloads
Lines changed: 120 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| |||
1837 | 1839 | | |
1838 | 1840 | | |
1839 | 1841 | | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
1840 | 1858 | | |
1841 | 1859 | | |
1842 | 1860 | | |
| |||
1862 | 1880 | | |
1863 | 1881 | | |
1864 | 1882 | | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
1865 | 1889 | | |
1866 | 1890 | | |
1867 | | - | |
| 1891 | + | |
1868 | 1892 | | |
1869 | 1893 | | |
1870 | 1894 | | |
| |||
1920 | 1944 | | |
1921 | 1945 | | |
1922 | 1946 | | |
| 1947 | + | |
1923 | 1948 | | |
1924 | 1949 | | |
1925 | 1950 | | |
| |||
1936 | 1961 | | |
1937 | 1962 | | |
1938 | 1963 | | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
1939 | 1971 | | |
1940 | 1972 | | |
1941 | 1973 | | |
| |||
2048 | 2080 | | |
2049 | 2081 | | |
2050 | 2082 | | |
| 2083 | + | |
2051 | 2084 | | |
2052 | 2085 | | |
2053 | 2086 | | |
2054 | 2087 | | |
| 2088 | + | |
2055 | 2089 | | |
2056 | 2090 | | |
2057 | 2091 | | |
| |||
2069 | 2103 | | |
2070 | 2104 | | |
2071 | 2105 | | |
2072 | | - | |
| 2106 | + | |
2073 | 2107 | | |
2074 | 2108 | | |
2075 | 2109 | | |
2076 | 2110 | | |
2077 | | - | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
2078 | 2118 | | |
2079 | 2119 | | |
2080 | 2120 | | |
| |||
2168 | 2208 | | |
2169 | 2209 | | |
2170 | 2210 | | |
| 2211 | + | |
2171 | 2212 | | |
2172 | 2213 | | |
2173 | 2214 | | |
| |||
2378 | 2419 | | |
2379 | 2420 | | |
2380 | 2421 | | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
2381 | 2498 | | |
2382 | 2499 | | |
2383 | 2500 | | |
| |||
Lines changed: 148 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| 275 | + | |
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
| |||
3317 | 3318 | | |
3318 | 3319 | | |
3319 | 3320 | | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
| 3330 | + | |
| 3331 | + | |
| 3332 | + | |
| 3333 | + | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
| 3347 | + | |
| 3348 | + | |
| 3349 | + | |
| 3350 | + | |
| 3351 | + | |
| 3352 | + | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
| 3357 | + | |
| 3358 | + | |
| 3359 | + | |
| 3360 | + | |
| 3361 | + | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
| 3380 | + | |
| 3381 | + | |
| 3382 | + | |
| 3383 | + | |
| 3384 | + | |
| 3385 | + | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
| 3389 | + | |
| 3390 | + | |
| 3391 | + | |
| 3392 | + | |
| 3393 | + | |
| 3394 | + | |
| 3395 | + | |
| 3396 | + | |
| 3397 | + | |
| 3398 | + | |
| 3399 | + | |
| 3400 | + | |
| 3401 | + | |
| 3402 | + | |
| 3403 | + | |
| 3404 | + | |
| 3405 | + | |
| 3406 | + | |
| 3407 | + | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
| 3414 | + | |
| 3415 | + | |
| 3416 | + | |
| 3417 | + | |
| 3418 | + | |
| 3419 | + | |
| 3420 | + | |
| 3421 | + | |
| 3422 | + | |
| 3423 | + | |
| 3424 | + | |
| 3425 | + | |
| 3426 | + | |
| 3427 | + | |
| 3428 | + | |
| 3429 | + | |
| 3430 | + | |
| 3431 | + | |
| 3432 | + | |
| 3433 | + | |
| 3434 | + | |
| 3435 | + | |
| 3436 | + | |
| 3437 | + | |
| 3438 | + | |
| 3439 | + | |
| 3440 | + | |
| 3441 | + | |
| 3442 | + | |
| 3443 | + | |
| 3444 | + | |
| 3445 | + | |
| 3446 | + | |
| 3447 | + | |
| 3448 | + | |
| 3449 | + | |
| 3450 | + | |
| 3451 | + | |
| 3452 | + | |
| 3453 | + | |
| 3454 | + | |
| 3455 | + | |
| 3456 | + | |
| 3457 | + | |
| 3458 | + | |
| 3459 | + | |
| 3460 | + | |
| 3461 | + | |
| 3462 | + | |
| 3463 | + | |
| 3464 | + | |
| 3465 | + | |
| 3466 | + | |
| 3467 | + | |
0 commit comments