diff --git a/frontend/src/components/ingress/Details.stories.tsx b/frontend/src/components/ingress/Details.stories.tsx index 739ac92b4d..facf985ca0 100644 --- a/frontend/src/components/ingress/Details.stories.tsx +++ b/frontend/src/components/ingress/Details.stories.tsx @@ -2,7 +2,7 @@ import { Meta, StoryFn } from '@storybook/react'; import Ingress, { KubeIngress } from '../../lib/k8s/ingress'; import { TestContext } from '../../test'; import Details from './Details'; -import { PORT_INGRESS, RESOURCE_INGRESS } from './storyHelper'; +import { PORT_INGRESS, RESOURCE_INGRESS, WILDCARD_TLS_INGRESS } from './storyHelper'; export default { title: 'Ingress/DetailsView', @@ -40,3 +40,8 @@ export const WithResource = Template.bind({}); WithResource.args = { ingressJson: RESOURCE_INGRESS, }; + +export const WithWildcardTLS = Template.bind({}); +WithWildcardTLS.args = { + ingressJson: WILDCARD_TLS_INGRESS, +}; diff --git a/frontend/src/components/ingress/__snapshots__/Details.WithWildcardTLS.stories.storyshot b/frontend/src/components/ingress/__snapshots__/Details.WithWildcardTLS.stories.storyshot new file mode 100644 index 0000000000..ba406c6531 --- /dev/null +++ b/frontend/src/components/ingress/__snapshots__/Details.WithWildcardTLS.stories.storyshot @@ -0,0 +1,348 @@ + +
+
+
+ +
+
+
+
+
+
+
+

+ Ingress +

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name +
+
+ + wildcard-tls-example-ingress + +
+
+ Namespace +
+
+ + default + +
+
+ Creation +
+
+ + 2023-07-19T09:48:42.000Z + +
+
+ Default Backend +
+
+ + - + +
+
+ Ports +
+
+ + 443 + +
+
+ TLS +
+
+ + wildcard-cert 🞂 *.one.domain.tld, *.two.domain.tld + +
+
+ Class Name +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ Events +

+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + +
+ Type + + Reason + + From + + Message + + Age + +
+ Normal + + Created + + kubelet + +
+ +
+
+

+ 3mo +

+
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/frontend/src/components/ingress/storyHelper.ts b/frontend/src/components/ingress/storyHelper.ts index 586191551b..afbf2d8b59 100644 --- a/frontend/src/components/ingress/storyHelper.ts +++ b/frontend/src/components/ingress/storyHelper.ts @@ -93,6 +93,28 @@ export const RESOURCE_INGRESS = { }, }; +export const WILDCARD_TLS_INGRESS = { + apiVersion: 'networking.k8s.io/v1', + kind: 'Ingress', + metadata: { + creationTimestamp: '2023-07-19T09:48:42Z', + generation: 1, + name: 'wildcard-tls-example-ingress', + namespace: 'default', + resourceVersion: '1234', + uid: 'abc1234', + }, + spec: { + rules: [{ host: '*.one.domain.tld' }, { host: '*.two.domain.tld' }], + tls: [ + { + hosts: ['*.one.domain.tld', '*.two.domain.tld'], + secretName: 'wildcard-cert', + }, + ], + }, +}; + export const RESOURCE_INGRESS_CLASS = { apiVersion: 'networking.k8s.io/v1', kind: 'IngressClass', diff --git a/frontend/src/lib/k8s/ingress.ts b/frontend/src/lib/k8s/ingress.ts index b546e581f2..a2f6ac3b34 100644 --- a/frontend/src/lib/k8s/ingress.ts +++ b/frontend/src/lib/k8s/ingress.ts @@ -92,31 +92,38 @@ class Ingress extends makeKubeObject('ingress') { const rules: IngressRule[] = []; this.spec!.rules?.forEach(({ http, host }) => { - const paths = http.paths.map(({ backend, path }) => { - if (!!(backend as LegacyIngressBackend).serviceName) { - return { - path, - backend: { - service: { - name: (backend as LegacyIngressBackend).serviceName, - port: { - number: parseInt((backend as LegacyIngressBackend).servicePort, 10), + if (http) { + const paths = http.paths.map(({ backend, path }) => { + if (!!(backend as LegacyIngressBackend).serviceName) { + return { + path, + backend: { + service: { + name: (backend as LegacyIngressBackend).serviceName, + port: { + number: parseInt((backend as LegacyIngressBackend).servicePort, 10), + }, }, }, - }, - }; - } else { - return { - path, - backend: backend as IngressBackend, - }; - } - }); - - rules.push({ - host, - http: { paths }, - }); + }; + } else { + return { + path, + backend: backend as IngressBackend, + }; + } + }); + + rules.push({ + host, + http: { paths }, + }); + } else { + rules.push({ + host, + http: { paths: [] }, + }); + } }); this.cachedRules = rules;