1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 21:39:40 +02:00

fix(app): fix app ingress edge cases [EE-5663] (#9150)

Co-authored-by: testa113 <testa113>
This commit is contained in:
Ali 2023-07-10 16:20:22 +12:00 committed by GitHub
parent 8b11e1678e
commit c752b98120
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 10 deletions

View file

@ -512,6 +512,17 @@ class KubernetesCreateApplicationController {
/* #region SERVICES UI MANAGEMENT */
onServicesChange(services) {
return this.$async(async () => {
// if the ingress isn't found in the currently loaded ingresses, then refresh the ingresses
const ingressNamesUsed = services.flatMap((s) => s.Ports.flatMap((p) => (p.ingressPaths ? p.ingressPaths.flatMap((ip) => ip.IngressName || []) : [])));
if (ingressNamesUsed.length) {
const uniqueIngressNamesUsed = Array.from(new Set(ingressNamesUsed)); // get the unique ingress names used
const ingressNamesLoaded = this.ingresses.map((i) => i.Name);
const areAllIngressesLoaded = uniqueIngressNamesUsed.every((ingressNameUsed) => ingressNamesLoaded.includes(ingressNameUsed));
if (!areAllIngressesLoaded) {
this.refreshIngresses();
}
}
// update the services
this.formValues.Services = services;
});
}
@ -1127,7 +1138,6 @@ class KubernetesCreateApplicationController {
this.nodesLabels,
this.ingresses
);
this.originalServicePorts = structuredClone(this.formValues.Services.flatMap((service) => service.Ports));
this.originalIngressPaths = structuredClone(this.originalServicePorts.flatMap((port) => port.ingressPaths).filter((ingressPath) => ingressPath.Host));