mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Adjust for validation moving to the version.schema
Signed-off-by: Trevor Nichols <trevor@nichols.id.au>
This commit is contained in:
parent
23f38984f7
commit
b787215de3
@ -2,7 +2,6 @@ import { KubeObject } from "../kube-object";
|
|||||||
import { VersionedKubeApi } from "../kube-api-versioned";
|
import { VersionedKubeApi } from "../kube-api-versioned";
|
||||||
import { crdResourcesURL } from "../../components/+custom-resources/crd.route";
|
import { crdResourcesURL } from "../../components/+custom-resources/crd.route";
|
||||||
|
|
||||||
|
|
||||||
type AdditionalPrinterColumnsCommon = {
|
type AdditionalPrinterColumnsCommon = {
|
||||||
name: string;
|
name: string;
|
||||||
type: "integer" | "number" | "string" | "boolean" | "date";
|
type: "integer" | "number" | "string" | "boolean" | "date";
|
||||||
@ -23,7 +22,7 @@ export class CustomResourceDefinition extends KubeObject {
|
|||||||
|
|
||||||
spec: {
|
spec: {
|
||||||
group: string;
|
group: string;
|
||||||
version?: string;
|
version?: string; // deprecated in v1 api
|
||||||
names: {
|
names: {
|
||||||
plural: string;
|
plural: string;
|
||||||
singular: string;
|
singular: string;
|
||||||
@ -36,13 +35,14 @@ export class CustomResourceDefinition extends KubeObject {
|
|||||||
name: string;
|
name: string;
|
||||||
served: boolean;
|
served: boolean;
|
||||||
storage: boolean;
|
storage: boolean;
|
||||||
|
schema?: unknown; // required in v1 but not present in v1beta
|
||||||
additionalPrinterColumns?: AdditionalPrinterColumnsV1[]
|
additionalPrinterColumns?: AdditionalPrinterColumnsV1[]
|
||||||
}[];
|
}[];
|
||||||
conversion: {
|
conversion: {
|
||||||
strategy?: string;
|
strategy?: string;
|
||||||
webhook?: any;
|
webhook?: any;
|
||||||
};
|
};
|
||||||
additionalPrinterColumns?: AdditionalPrinterColumnsV1Beta[];
|
additionalPrinterColumns?: AdditionalPrinterColumnsV1Beta[]; // removed in v1
|
||||||
}
|
}
|
||||||
status: {
|
status: {
|
||||||
conditions: {
|
conditions: {
|
||||||
@ -98,7 +98,8 @@ export class CustomResourceDefinition extends KubeObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getVersion() {
|
getVersion() {
|
||||||
return this.spec.version ?? this.spec.versions.find(a => a.storage)?.name;
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
isNamespaced() {
|
isNamespaced() {
|
||||||
@ -127,7 +128,7 @@ export class CustomResourceDefinition extends KubeObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getValidation() {
|
getValidation() {
|
||||||
return JSON.stringify(this.spec.validation, null, 2);
|
return JSON.stringify(this.spec.validation ?? this.spec.versions?.[0]?.schema, null, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
getConditions() {
|
getConditions() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user