diff --git a/frontend/src/components/ingress/Details.tsx b/frontend/src/components/ingress/Details.tsx index b896c9e3fa..7c45d3d33e 100644 --- a/frontend/src/components/ingress/Details.tsx +++ b/frontend/src/components/ingress/Details.tsx @@ -161,7 +161,7 @@ export default function IngressDetails(props: { name?: string; namespace?: strin function getPorts(item: Ingress) { const ports: string[] = []; item.getRules().forEach(rule => { - rule.http.paths.forEach(path => { + rule.http?.paths.forEach(path => { if (!!path.backend.service) { const portNumber = path.backend.service.port.number ?? path.backend.service.port.name ?? ''; @@ -243,7 +243,7 @@ export default function IngressDetails(props: { name?: string; namespace?: strin { label: t('translation|Path'), getter: (data: IngressRule) => - data.http.paths.map(({ path }) => ( + data.http?.paths.map(({ path }) => ( ( - backend)} /> + backend) ?? []} + /> ), }, ]} diff --git a/frontend/src/components/ingress/List.tsx b/frontend/src/components/ingress/List.tsx index 3250b9c903..98925e2bb4 100644 --- a/frontend/src/components/ingress/List.tsx +++ b/frontend/src/components/ingress/List.tsx @@ -13,17 +13,18 @@ function RulesDisplay(props: { ingress: Ingress }) { let labels: string[] = []; rules.forEach(({ http }) => { - const text = http.paths.map(({ path, backend }) => { - let target = ''; - if (!!backend.service) { - const service = backend.service.name; - const port = backend.service.port.number ?? backend.service.port.name ?? ''; - target = `${!!service ? service + ':' + port.toString() : port.toString()}`; - } else if (!!backend.resource) { - target = `${backend.resource.kind}:${backend.resource.name}`; - } - return `${path} 🞂 ${target}`; - }); + const text = + http?.paths.map(({ path, backend }) => { + let target = ''; + if (!!backend.service) { + const service = backend.service.name; + const port = backend.service.port.number ?? backend.service.port.name ?? ''; + target = `${!!service ? service + ':' + port.toString() : port.toString()}`; + } else if (!!backend.resource) { + target = `${backend.resource.kind}:${backend.resource.name}`; + } + return `${path} 🞂 ${target}`; + }) ?? ''; labels = labels.concat(text); }); diff --git a/frontend/src/components/resourceMap/sources/definitions/networkSource.tsx b/frontend/src/components/resourceMap/sources/definitions/networkSource.tsx index ece0063e42..665aef5cc1 100644 --- a/frontend/src/components/resourceMap/sources/definitions/networkSource.tsx +++ b/frontend/src/components/resourceMap/sources/definitions/networkSource.tsx @@ -83,7 +83,7 @@ const ingressListSource: GraphSource = { ingresses.forEach(ingress => { ingress.spec.rules.forEach((rule: IngressRule) => { - rule.http.paths.forEach(path => { + rule.http?.paths?.forEach(path => { const service = services.find( service => service.metadata.name === path?.backend?.service?.name ); diff --git a/frontend/src/lib/k8s/ingress.ts b/frontend/src/lib/k8s/ingress.ts index 25a2f2e703..b4abd42fe2 100644 --- a/frontend/src/lib/k8s/ingress.ts +++ b/frontend/src/lib/k8s/ingress.ts @@ -12,7 +12,7 @@ interface LegacyIngressRule { export interface IngressRule { host: string; - http: { + http?: { paths: { path: string; pathType?: string;