1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Change HPA apiBase and add fallback bases

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2023-01-11 10:28:57 +03:00
parent 8f9dd11420
commit e872248c23

View File

@ -153,7 +153,7 @@ export class HorizontalPodAutoscaler extends KubeObject<
> { > {
static readonly kind = "HorizontalPodAutoscaler"; static readonly kind = "HorizontalPodAutoscaler";
static readonly namespaced = true; static readonly namespaced = true;
static readonly apiBase = "/apis/autoscaling/v2beta1/horizontalpodautoscalers"; static readonly apiBase = "/apis/autoscaling/v2/horizontalpodautoscalers";
getMaxPods() { getMaxPods() {
return this.spec.maxReplicas ?? 0; return this.spec.maxReplicas ?? 0;
@ -204,8 +204,15 @@ export class HorizontalPodAutoscaler extends KubeObject<
export class HorizontalPodAutoscalerApi extends KubeApi<HorizontalPodAutoscaler> { export class HorizontalPodAutoscalerApi extends KubeApi<HorizontalPodAutoscaler> {
constructor(deps: KubeApiDependencies, opts?: DerivedKubeApiOptions) { constructor(deps: KubeApiDependencies, opts?: DerivedKubeApiOptions) {
super(deps, { super(deps, {
objectConstructor: HorizontalPodAutoscaler,
...opts ?? {}, ...opts ?? {},
objectConstructor: HorizontalPodAutoscaler,
checkPreferredVersion: true,
// Kubernetes < 1.26
fallbackApiBases: [
"/apis/autoscaling/v2beta2/horizontalpodautoscalers",
"/apis/autoscaling/v2beta1/horizontalpodautoscalers",
"/apis/autoscaling/v1/horizontalpodautoscalers",
],
}); });
} }
} }