From 92ec42f71249a70e833844a09c7993c0aa1a727f Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Fri, 9 Apr 2021 09:19:30 -0400 Subject: [PATCH] fix versions not being defined Signed-off-by: Sebastian Malton --- src/renderer/api/endpoints/crd.api.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderer/api/endpoints/crd.api.ts b/src/renderer/api/endpoints/crd.api.ts index ad7d9d67ca..f51df634fe 100644 --- a/src/renderer/api/endpoints/crd.api.ts +++ b/src/renderer/api/endpoints/crd.api.ts @@ -33,7 +33,7 @@ export class CustomResourceDefinition extends KubeObject { }; scope: "Namespaced" | "Cluster" | string; validation?: any; - versions: { + versions?: { name: string; served: boolean; storage: boolean; @@ -103,7 +103,7 @@ export class CustomResourceDefinition extends KubeObject { getVersion() { // v1 has removed the spec.version property, if it is present it must match the first version - return this.spec.versions[0]?.name ?? this.spec.version; + return this.spec.versions?.[0]?.name ?? this.spec.version; } isNamespaced() { @@ -123,7 +123,7 @@ export class CustomResourceDefinition extends KubeObject { } getPrinterColumns(ignorePriority = true): AdditionalPrinterColumnsV1[] { - const columns = this.spec.versions.find(a => this.getVersion() == a.name)?.additionalPrinterColumns + const columns = this.spec.versions?.find(a => this.getVersion() == a.name)?.additionalPrinterColumns ?? this.spec.additionalPrinterColumns?.map(({ JSONPath, ...rest }) => ({ ...rest, jsonPath: JSONPath })) // map to V1 shape ?? [];