mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-18 10:12:55 +02:00
Track public inference domains to avoid duplicate routers for siteResource aliases
This commit is contained in:
@@ -597,6 +597,12 @@ export async function getTraefikConfig(
|
|||||||
// Public inference resources: same TLS/cert-resolver handling as
|
// Public inference resources: same TLS/cert-resolver handling as
|
||||||
// plain http-mode resources, but the service points at the AI
|
// plain http-mode resources, but the service points at the AI
|
||||||
// gateway instead of any real backend targets.
|
// gateway instead of any real backend targets.
|
||||||
|
//
|
||||||
|
// A siteResource inference alias can share the exact same fullDomain
|
||||||
|
// as one of these (both ultimately proxy to the same aiGatewayUrl),
|
||||||
|
// so track which domains get a public router here and skip creating
|
||||||
|
// a second, duplicate router for the siteResource alias below.
|
||||||
|
const publicInferenceDomains = new Set<string>();
|
||||||
for (const ir of inferenceResources) {
|
for (const ir of inferenceResources) {
|
||||||
if (!ir.enabled) continue;
|
if (!ir.enabled) continue;
|
||||||
if (!ir.domainId || !ir.fullDomain) continue;
|
if (!ir.domainId || !ir.fullDomain) continue;
|
||||||
@@ -644,6 +650,7 @@ export async function getTraefikConfig(
|
|||||||
});
|
});
|
||||||
Object.assign(config_output.http.routers, routers);
|
Object.assign(config_output.http.routers, routers);
|
||||||
Object.assign(config_output.http.services, services);
|
Object.assign(config_output.http.services, services);
|
||||||
|
publicInferenceDomains.add(fullDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Private (siteResource) inference resources: routed by their alias
|
// Private (siteResource) inference resources: routed by their alias
|
||||||
@@ -670,6 +677,11 @@ export async function getTraefikConfig(
|
|||||||
for (const sr of siteResourcesInference) {
|
for (const sr of siteResourcesInference) {
|
||||||
if (!sr.enabled || !sr.fullDomain) continue;
|
if (!sr.enabled || !sr.fullDomain) continue;
|
||||||
|
|
||||||
|
// A public inference resource already owns a router for
|
||||||
|
// this exact fullDomain - both point at the same AI gateway,
|
||||||
|
// so avoid registering a duplicate router for it here.
|
||||||
|
if (publicInferenceDomains.has(sr.fullDomain)) continue;
|
||||||
|
|
||||||
if (!config_output.http.routers)
|
if (!config_output.http.routers)
|
||||||
config_output.http.routers = {};
|
config_output.http.routers = {};
|
||||||
if (!config_output.http.services)
|
if (!config_output.http.services)
|
||||||
|
|||||||
@@ -892,6 +892,12 @@ export async function getTraefikConfig(
|
|||||||
// Public inference resources: same TLS/cert-resolver handling as
|
// Public inference resources: same TLS/cert-resolver handling as
|
||||||
// plain http-mode resources, but the service points at the AI
|
// plain http-mode resources, but the service points at the AI
|
||||||
// gateway instead of any real backend targets.
|
// gateway instead of any real backend targets.
|
||||||
|
//
|
||||||
|
// A siteResource inference alias can share the exact same fullDomain
|
||||||
|
// as one of these (both ultimately proxy to the same aiGatewayUrl),
|
||||||
|
// so track which domains get a public router here and skip creating
|
||||||
|
// a second, duplicate router for the siteResource alias below.
|
||||||
|
const publicInferenceDomains = new Set<string>();
|
||||||
for (const ir of inferenceResources) {
|
for (const ir of inferenceResources) {
|
||||||
if (!ir.enabled) continue;
|
if (!ir.enabled) continue;
|
||||||
if (!ir.domainId || !ir.fullDomain) continue;
|
if (!ir.domainId || !ir.fullDomain) continue;
|
||||||
@@ -958,6 +964,7 @@ export async function getTraefikConfig(
|
|||||||
});
|
});
|
||||||
Object.assign(config_output.http.routers, routers);
|
Object.assign(config_output.http.routers, routers);
|
||||||
Object.assign(config_output.http.services, services);
|
Object.assign(config_output.http.services, services);
|
||||||
|
publicInferenceDomains.add(fullDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exitNode) {
|
if (exitNode) {
|
||||||
@@ -969,6 +976,11 @@ export async function getTraefikConfig(
|
|||||||
for (const sr of siteResourcesInference) {
|
for (const sr of siteResourcesInference) {
|
||||||
if (!sr.enabled || !sr.fullDomain) continue;
|
if (!sr.enabled || !sr.fullDomain) continue;
|
||||||
|
|
||||||
|
// A public inference resource already owns a router for
|
||||||
|
// this exact fullDomain - both point at the same AI gateway,
|
||||||
|
// so avoid registering a duplicate router for it here.
|
||||||
|
if (publicInferenceDomains.has(sr.fullDomain)) continue;
|
||||||
|
|
||||||
if (!config_output.http.routers)
|
if (!config_output.http.routers)
|
||||||
config_output.http.routers = {};
|
config_output.http.routers = {};
|
||||||
if (!config_output.http.services)
|
if (!config_output.http.services)
|
||||||
|
|||||||
Reference in New Issue
Block a user