mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import { autobind } from "../../utils";
|
|
import { KubeObject } from "../kube-object";
|
|
import { KubeApi } from "../kube-api";
|
|
|
|
@autobind()
|
|
export class PodDisruptionBudget extends KubeObject {
|
|
static kind = "PodDisruptionBudget";
|
|
static namespaced = true;
|
|
static apiBase = "/apis/policy/v1beta1/poddisruptionbudgets";
|
|
|
|
spec: {
|
|
minAvailable: string;
|
|
maxUnavailable: string;
|
|
selector: { matchLabels: { [app: string]: string } };
|
|
};
|
|
status: {
|
|
currentHealthy: number
|
|
desiredHealthy: number
|
|
disruptionsAllowed: number
|
|
expectedPods: number
|
|
};
|
|
|
|
getSelectors() {
|
|
const selector = this.spec.selector;
|
|
return KubeObject.stringifyLabels(selector ? selector.matchLabels : null);
|
|
}
|
|
|
|
getMinAvailable() {
|
|
return this.spec.minAvailable || "N/A";
|
|
}
|
|
|
|
getMaxUnavailable() {
|
|
return this.spec.maxUnavailable || "N/A";
|
|
}
|
|
|
|
getCurrentHealthy() {
|
|
return this.status.currentHealthy;
|
|
}
|
|
|
|
getDesiredHealthy() {
|
|
return this.status.desiredHealthy;
|
|
}
|
|
|
|
}
|
|
|
|
export const pdbApi = new KubeApi({
|
|
objectConstructor: PodDisruptionBudget,
|
|
});
|