1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

feat(app): add ingress to app service form [EE-5569] (#9106)

This commit is contained in:
Ali 2023-06-26 16:21:19 +12:00 committed by GitHub
parent 8c16fbb8aa
commit 89c1d0e337
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 1929 additions and 1181 deletions

View file

@ -307,22 +307,18 @@ class KubernetesApplicationHelper {
svcport.protocol = port.protocol;
svcport.targetPort = port.targetPort;
svcport.serviceName = service.metadata.name;
svcport.ingress = {};
svcport.ingressPaths = [];
app.Ingresses.value.forEach((ingress) => {
const ingressNameMatched = ingress.Paths.find((ingPath) => ingPath.ServiceName === service.metadata.name);
const ingressPortMatched = ingress.Paths.find((ingPath) => ingPath.Port === port.port);
// only add ingress info to the port if the ingress serviceport matches the port in the service
if (ingressPortMatched) {
svcport.ingress = {
IngressName: ingressPortMatched.IngressName,
Host: ingressPortMatched.Host,
Path: ingressPortMatched.Path,
};
}
if (ingressNameMatched) {
svc.Ingress = true;
}
const matchingIngressPaths = ingress.Paths.filter((ingPath) => ingPath.ServiceName === service.metadata.name && ingPath.Port === port.port);
// only add ingress info to the port if the ingress serviceport and name matches
const newPaths = matchingIngressPaths.map((ingPath) => ({
IngressName: ingPath.IngressName,
Host: ingPath.Host,
Path: ingPath.Path,
}));
svcport.ingressPaths = [...svcport.ingressPaths, ...newPaths];
svc.Ingress = matchingIngressPaths.length > 0;
});
ports.push(svcport);