mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-05 10:16:41 +00:00
Merge branch 'main' into dev
This commit is contained in:
@@ -36,7 +36,9 @@ export async function applyNewtDockerBlueprint(
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
isEmptyObject(blueprint["proxy-resources"]) &&
|
isEmptyObject(blueprint["proxy-resources"]) &&
|
||||||
isEmptyObject(blueprint["client-resources"])
|
isEmptyObject(blueprint["client-resources"]) &&
|
||||||
|
isEmptyObject(blueprint["public-resources"]) &&
|
||||||
|
isEmptyObject(blueprint["private-resources"])
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,10 +54,14 @@ function getContainerPort(container: Container): number | null {
|
|||||||
export function processContainerLabels(containers: Container[]): {
|
export function processContainerLabels(containers: Container[]): {
|
||||||
"proxy-resources": { [key: string]: ResourceConfig };
|
"proxy-resources": { [key: string]: ResourceConfig };
|
||||||
"client-resources": { [key: string]: ResourceConfig };
|
"client-resources": { [key: string]: ResourceConfig };
|
||||||
|
"public-resources": { [key: string]: ResourceConfig };
|
||||||
|
"private-resources": { [key: string]: ResourceConfig };
|
||||||
} {
|
} {
|
||||||
const result = {
|
const result = {
|
||||||
"proxy-resources": {} as { [key: string]: ResourceConfig },
|
"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
|
// Process each container
|
||||||
@@ -68,8 +72,10 @@ export function processContainerLabels(containers: Container[]): {
|
|||||||
|
|
||||||
const proxyResourceLabels: DockerLabels = {};
|
const proxyResourceLabels: DockerLabels = {};
|
||||||
const clientResourceLabels: 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]) => {
|
Object.entries(container.labels).forEach(([key, value]) => {
|
||||||
if (key.startsWith("pangolin.proxy-resources.")) {
|
if (key.startsWith("pangolin.proxy-resources.")) {
|
||||||
// remove the pangolin.proxy- prefix to get "resources.xxx"
|
// 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"
|
// remove the pangolin.client- prefix to get "resources.xxx"
|
||||||
const strippedKey = key.replace("pangolin.client-", "");
|
const strippedKey = key.replace("pangolin.client-", "");
|
||||||
clientResourceLabels[strippedKey] = value;
|
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"]
|
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;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user