Skip to content

Commit 6060b1d

Browse files
Merge branch 'main' into dev
2 parents c91b4be + 7507806 commit 6060b1d

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

server/lib/blueprints/applyNewtDockerBlueprint.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ export async function applyNewtDockerBlueprint(
3636

3737
if (
3838
isEmptyObject(blueprint["proxy-resources"]) &&
39-
isEmptyObject(blueprint["client-resources"])
39+
isEmptyObject(blueprint["client-resources"]) &&
40+
isEmptyObject(blueprint["public-resources"]) &&
41+
isEmptyObject(blueprint["private-resources"])
4042
) {
4143
return;
4244
}

server/lib/blueprints/parseDockerContainers.ts

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@ function getContainerPort(container: Container): number | null {
5454
export function processContainerLabels(containers: Container[]): {
5555
"proxy-resources": { [key: string]: ResourceConfig };
5656
"client-resources": { [key: string]: ResourceConfig };
57+
"public-resources": { [key: string]: ResourceConfig };
58+
"private-resources": { [key: string]: ResourceConfig };
5759
} {
5860
const result = {
5961
"proxy-resources": {} as { [key: string]: ResourceConfig },
60-
"client-resources": {} as { [key: string]: ResourceConfig }
62+
"client-resources": {} as { [key: string]: ResourceConfig },
63+
"public-resources": {} as { [key: string]: ResourceConfig },
64+
"private-resources": {} as { [key: string]: ResourceConfig }
6165
};
6266

6367
// Process each container
@@ -68,8 +72,10 @@ export function processContainerLabels(containers: Container[]): {
6872

6973
const proxyResourceLabels: DockerLabels = {};
7074
const clientResourceLabels: DockerLabels = {};
75+
const publicResourceLabels: DockerLabels = {};
76+
const privateResourceLabels: DockerLabels = {};
7177

72-
// Filter and separate proxy-resources and client-resources labels
78+
// Filter and separate proxy-resources, client-resources, public-resources, and private-resources labels
7379
Object.entries(container.labels).forEach(([key, value]) => {
7480
if (key.startsWith("pangolin.proxy-resources.")) {
7581
// remove the pangolin.proxy- prefix to get "resources.xxx"
@@ -79,6 +85,14 @@ export function processContainerLabels(containers: Container[]): {
7985
// remove the pangolin.client- prefix to get "resources.xxx"
8086
const strippedKey = key.replace("pangolin.client-", "");
8187
clientResourceLabels[strippedKey] = value;
88+
} else if (key.startsWith("pangolin.public-resources.")) {
89+
// remove the pangolin.public- prefix to get "resources.xxx"
90+
const strippedKey = key.replace("pangolin.public-", "");
91+
publicResourceLabels[strippedKey] = value;
92+
} else if (key.startsWith("pangolin.private-resources.")) {
93+
// remove the pangolin.private- prefix to get "resources.xxx"
94+
const strippedKey = key.replace("pangolin.private-", "");
95+
privateResourceLabels[strippedKey] = value;
8296
}
8397
});
8498

@@ -99,6 +113,24 @@ export function processContainerLabels(containers: Container[]): {
99113
result["client-resources"]
100114
);
101115
}
116+
117+
// Process public resources (alias for proxy resources)
118+
if (Object.keys(publicResourceLabels).length > 0) {
119+
processResourceLabels(
120+
publicResourceLabels,
121+
container,
122+
result["public-resources"]
123+
);
124+
}
125+
126+
// Process private resources (alias for client resources)
127+
if (Object.keys(privateResourceLabels).length > 0) {
128+
processResourceLabels(
129+
privateResourceLabels,
130+
container,
131+
result["private-resources"]
132+
);
133+
}
102134
});
103135

104136
return result;

0 commit comments

Comments
 (0)