diff --git a/packages/main/src/plugin/api/openshift-types.ts b/packages/main/src/plugin/api/openshift-types.ts index 467148647b0c0..1648733ccb613 100644 --- a/packages/main/src/plugin/api/openshift-types.ts +++ b/packages/main/src/plugin/api/openshift-types.ts @@ -26,9 +26,10 @@ export type V1Route = { }; spec: { host: string; - port: { + port?: { targetPort: string; }; + path?: string; tls: { insecureEdgeTerminationPolicy: string; termination: string; diff --git a/packages/renderer/src/lib/ingresses-routes/RouteUI.ts b/packages/renderer/src/lib/ingresses-routes/RouteUI.ts index 2d81afe426880..f341f6681afaa 100644 --- a/packages/renderer/src/lib/ingresses-routes/RouteUI.ts +++ b/packages/renderer/src/lib/ingresses-routes/RouteUI.ts @@ -25,7 +25,8 @@ export interface RouteUI { name: string; namespace: string; host: string; - port: string; + port?: string; + path?: string; to: RouteToReference; selected: boolean; } diff --git a/packages/renderer/src/lib/ingresses-routes/ingress-route-utils.spec.ts b/packages/renderer/src/lib/ingresses-routes/ingress-route-utils.spec.ts index 7ef9d1e96bfa0..446dd3550af32 100644 --- a/packages/renderer/src/lib/ingresses-routes/ingress-route-utils.spec.ts +++ b/packages/renderer/src/lib/ingresses-routes/ingress-route-utils.spec.ts @@ -63,7 +63,7 @@ test('expect basic UI conversion for ingress', async () => { expect(ingressUI.rules).equal(ingress.spec?.rules); }); -test('expect basic UI conversion for route', async () => { +test('expect basic UI conversion for route with port', async () => { const route = { metadata: { name: 'my-route', @@ -84,7 +84,33 @@ test('expect basic UI conversion for route', async () => { expect(routeUI.name).toEqual('my-route'); expect(routeUI.namespace).toEqual('test-namespace'); expect(routeUI.host).toEqual(route.spec.host); - expect(routeUI.port).toEqual(route.spec.port.targetPort); + expect(routeUI.port).toEqual(route.spec.port?.targetPort); + expect(routeUI.path).toBeUndefined(); + expect(routeUI.to.kind).toEqual(route.spec.to.kind); + expect(routeUI.to.name).toEqual(route.spec.to.name); +}); + +test('expect basic UI conversion for route with path', async () => { + const route = { + metadata: { + name: 'my-route', + namespace: 'test-namespace', + }, + spec: { + host: 'foo.bar.com', + path: '/test', + to: { + kind: 'Service', + name: 'service', + }, + }, + } as V1Route; + const routeUI = ingressRouteUtils.getRouteUI(route); + expect(routeUI.name).toEqual('my-route'); + expect(routeUI.namespace).toEqual('test-namespace'); + expect(routeUI.host).toEqual(route.spec.host); + expect(routeUI.port).toBeUndefined(); + expect(routeUI.path).toEqual(route.spec.path); expect(routeUI.to.kind).toEqual(route.spec.to.kind); expect(routeUI.to.name).toEqual(route.spec.to.name); }); diff --git a/packages/renderer/src/lib/ingresses-routes/ingress-route-utils.ts b/packages/renderer/src/lib/ingresses-routes/ingress-route-utils.ts index 0b88aa4041948..f2426aaf1505e 100644 --- a/packages/renderer/src/lib/ingresses-routes/ingress-route-utils.ts +++ b/packages/renderer/src/lib/ingresses-routes/ingress-route-utils.ts @@ -35,7 +35,8 @@ export class IngressRouteUtils { name: route.metadata?.name || '', namespace: route.metadata?.namespace || '', host: route.spec.host, - port: route.spec.port.targetPort, + port: route.spec.port?.targetPort, + path: route.spec.path, to: { kind: route.spec.to.kind, name: route.spec.to.name, diff --git a/packages/renderer/src/lib/pod/DeployPodToKube.svelte b/packages/renderer/src/lib/pod/DeployPodToKube.svelte index 4f86c52b7e9bf..8bc4f3ad771c3 100644 --- a/packages/renderer/src/lib/pod/DeployPodToKube.svelte +++ b/packages/renderer/src/lib/pod/DeployPodToKube.svelte @@ -569,7 +569,7 @@ function updateKubeResult() {