From 7507806aaa71d74e26235dded3f9166569d84d44 Mon Sep 17 00:00:00 2001 From: Dhananjay Mahtha Date: Sun, 21 Dec 2025 16:41:38 +0530 Subject: [PATCH] Fix: Support public-resources and private-resources in Docker blueprint labels - Add support for pangolin.public-resources.* labels as alias for proxy-resources - Add support for pangolin.private-resources.* labels as alias for client-resources - Update processContainerLabels to parse all four resource type prefixes - Update early-exit check in applyNewtDockerBlueprint to consider all four resource keys - ConfigSchema transformation will merge public/private into proxy/client as designed Fixes #2125 --- .../blueprints/applyNewtDockerBlueprint.ts | 4 ++- .../lib/blueprints/parseDockerContainers.ts | 36 +++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/server/lib/blueprints/applyNewtDockerBlueprint.ts b/server/lib/blueprints/applyNewtDockerBlueprint.ts index f27cc05b..eb5fc787 100644 --- a/server/lib/blueprints/applyNewtDockerBlueprint.ts +++ b/server/lib/blueprints/applyNewtDockerBlueprint.ts @@ -36,7 +36,9 @@ export async function applyNewtDockerBlueprint( if ( isEmptyObject(blueprint["proxy-resources"]) && - isEmptyObject(blueprint["client-resources"]) + isEmptyObject(blueprint["client-resources"]) && + isEmptyObject(blueprint["public-resources"]) && + isEmptyObject(blueprint["private-resources"]) ) { return; } diff --git a/server/lib/blueprints/parseDockerContainers.ts b/server/lib/blueprints/parseDockerContainers.ts index f2cdcfa2..5befcbc3 100644 --- a/server/lib/blueprints/parseDockerContainers.ts +++ b/server/lib/blueprints/parseDockerContainers.ts @@ -54,10 +54,14 @@ function getContainerPort(container: Container): number | null { export function processContainerLabels(containers: Container[]): { "proxy-resources": { [key: string]: ResourceConfig }; "client-resources": { [key: string]: ResourceConfig }; + "public-resources": { [key: string]: ResourceConfig }; + "private-resources": { [key: string]: ResourceConfig }; } { const result = { "proxy-resources": {} as { [key: string]: ResourceConfig }, - "client-resources": {} as { [key: string]: ResourceConfig } + "client-resources": {} as { [key: string]: ResourceConfig }, + "public-resources": {} as { [key: string]: ResourceConfig }, + "private-resources": {} as { [key: string]: ResourceConfig } }; // Process each container @@ -68,8 +72,10 @@ export function processContainerLabels(containers: Container[]): { const proxyResourceLabels: DockerLabels = {}; const clientResourceLabels: DockerLabels = {}; + const publicResourceLabels: DockerLabels = {}; + const privateResourceLabels: DockerLabels = {}; - // Filter and separate proxy-resources and client-resources labels + // Filter and separate proxy-resources, client-resources, public-resources, and private-resources labels Object.entries(container.labels).forEach(([key, value]) => { if (key.startsWith("pangolin.proxy-resources.")) { // remove the pangolin.proxy- prefix to get "resources.xxx" @@ -79,6 +85,14 @@ export function processContainerLabels(containers: Container[]): { // remove the pangolin.client- prefix to get "resources.xxx" const strippedKey = key.replace("pangolin.client-", ""); clientResourceLabels[strippedKey] = value; + } else if (key.startsWith("pangolin.public-resources.")) { + // remove the pangolin.public- prefix to get "resources.xxx" + const strippedKey = key.replace("pangolin.public-", ""); + publicResourceLabels[strippedKey] = value; + } else if (key.startsWith("pangolin.private-resources.")) { + // remove the pangolin.private- prefix to get "resources.xxx" + const strippedKey = key.replace("pangolin.private-", ""); + privateResourceLabels[strippedKey] = value; } }); @@ -99,6 +113,24 @@ export function processContainerLabels(containers: Container[]): { result["client-resources"] ); } + + // Process public resources (alias for proxy resources) + if (Object.keys(publicResourceLabels).length > 0) { + processResourceLabels( + publicResourceLabels, + container, + result["public-resources"] + ); + } + + // Process private resources (alias for client resources) + if (Object.keys(privateResourceLabels).length > 0) { + processResourceLabels( + privateResourceLabels, + container, + result["private-resources"] + ); + } }); return result;