diff --git a/app/kubernetes/views/applications/create/createApplicationController.js b/app/kubernetes/views/applications/create/createApplicationController.js index e03316bf9..495b151a8 100644 --- a/app/kubernetes/views/applications/create/createApplicationController.js +++ b/app/kubernetes/views/applications/create/createApplicationController.js @@ -1001,9 +1001,11 @@ class KubernetesCreateApplicationController { if (updatedService.Ingress && numberOfPortsInOldService && numberOfPortsInOldService <= updatedService.Ports.length) { const updatedOldPorts = updatedService.Ports.slice(0, numberOfPortsInOldService); const ingressesForService = fullIngresses.filter((ing) => { - const ingServiceNames = ing.Paths.map((path) => path.ServiceName); - if (ingServiceNames.includes(updatedService.Name)) { - return true; + if (ing.Paths) { + const ingServiceNames = ing.Paths.map((path) => path.ServiceName); + if (ingServiceNames.includes(updatedService.Name)) { + return true; + } } }); ingressesForService.forEach((ingressForService) => { diff --git a/app/react/kubernetes/applications/CreateView/application-services/ingress/AppIngressPathForm.tsx b/app/react/kubernetes/applications/CreateView/application-services/ingress/AppIngressPathForm.tsx index 0676cf1cf..fc2efbf30 100644 --- a/app/react/kubernetes/applications/CreateView/application-services/ingress/AppIngressPathForm.tsx +++ b/app/react/kubernetes/applications/CreateView/application-services/ingress/AppIngressPathForm.tsx @@ -87,8 +87,16 @@ export function AppIngressPathForm({ Host: newIngressHostValue, IngressName: newIngressNameValue, }; + // the selected option should match the new ingress path + const newIngressOption = newIngressPath.Host + ? { + ingressName: newIngressPath.IngressName, + value: newIngressPath.Host ?? '', + label: `${newIngressPath.Host} (${newIngressPath.IngressName})`, + } + : null; onChangeIngressPath(newIngressPath); - setSelectedIngress(ingressHostOptionsWithCurrentValue[0] ?? null); + setSelectedIngress(newIngressOption); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [ingressHostOptionsWithCurrentValue]); @@ -129,7 +137,7 @@ export function AppIngressPathForm({ {ingressHostOptions.length === 0 && !ingressPath?.Host && ( No ingress hostnames are available for the namespace ' - {namespace}'. Please update the namespace or{' '} + {namespace}'. Please select another namespace or{' '} { - if (path === undefined || validationData === undefined) { + if ( + path === undefined || + validationData === undefined || + !context.parent.Host + ) { return true; } const ingressHostAndPath = `${