mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: resourceVersion can be a number
Signed-off-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
parent
6fc01284d3
commit
1f8c9c5103
@ -97,7 +97,7 @@ export interface DerivedKubeApiOptions {
|
||||
|
||||
export interface KubeApiQueryParams {
|
||||
watch?: boolean | number;
|
||||
resourceVersion?: string;
|
||||
resourceVersion?: string | number;
|
||||
timeoutSeconds?: number;
|
||||
limit?: number; // doesn't work with ?watch
|
||||
continue?: string; // might be used with ?limit from second request
|
||||
@ -272,7 +272,7 @@ export class KubeApi<
|
||||
|
||||
public readonly objectConstructor: KubeObjectConstructor<Object, Data>;
|
||||
protected readonly request: KubeJsonApi;
|
||||
protected readonly resourceVersions = new Map<string, string>();
|
||||
protected readonly resourceVersions = new Map<string, string | number>();
|
||||
protected readonly watchDisposer: Disposer | undefined;
|
||||
private watchId = 1;
|
||||
protected readonly doCheckPreferredVersion: boolean;
|
||||
@ -385,7 +385,7 @@ export class KubeApi<
|
||||
}
|
||||
}
|
||||
|
||||
setResourceVersion(namespace = "", newVersion: string) {
|
||||
setResourceVersion(namespace = "", newVersion: string | number) {
|
||||
this.resourceVersions.set(namespace, newVersion);
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import type { KubeObject } from "./kube-object";
|
||||
* The metadata for LIST requests to the KubeApi
|
||||
*/
|
||||
export interface KubeJsonApiListMetadata {
|
||||
resourceVersion: string;
|
||||
resourceVersion: string | number;
|
||||
selfLink?: string;
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ export type KubeObjectMetadata<Namespaced extends KubeObjectScope = KubeObjectSc
|
||||
readonly selfLink: string;
|
||||
readonly uid: string;
|
||||
readonly name: string;
|
||||
readonly resourceVersion: string;
|
||||
readonly resourceVersion: string | number;
|
||||
};
|
||||
|
||||
export type NamespaceScopedMetadata = KubeObjectMetadata<KubeObjectScope.Namespace>;
|
||||
@ -256,7 +256,7 @@ export interface EvictionObject {
|
||||
orphanDependents?: boolean;
|
||||
propagationPolicy?: string;
|
||||
preconditions?: {
|
||||
resourceVersion: string;
|
||||
resourceVersion: string | number;
|
||||
uid: string;
|
||||
}[];
|
||||
};
|
||||
|
||||
@ -118,13 +118,6 @@ export class KubeObject<
|
||||
);
|
||||
}
|
||||
|
||||
if (!isString(data.metadata.resourceVersion)) {
|
||||
throw new KubeCreationError(
|
||||
`Cannot create a KubeObject from an object without metadata.resourceVersion being a string`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
if (!isString(data.metadata.selfLink)) {
|
||||
throw new KubeCreationError(
|
||||
`Cannot create a KubeObject from an object without metadata.selfLink being a string`,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user