mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add support for PodDisruptionBudgets (#452)
Signed-off-by: Dan Slinky <dan-slinky@cookpad.jp>
This commit is contained in:
1 parent
5163ede4f1
commit
81a0c432c6
11 files changed
+248
-1
No files matched your search
@@ -28,3 +28,4 @@ export * from "./storage-class.api"
|
||||
export * from "./pod-metrics.api"
|
||||
export * from "./podsecuritypolicy.api"
|
||||
export * from "./selfsubjectrulesreviews.api"
|
||||
export * from "./poddisruptionbudget.api"
|
||||
@@ -0,0 +1,49 @@
|
||||
import { autobind } from "../../utils";
|
||||
import { KubeObject } from "../kube-object";
|
||||
import { KubeApi } from "../kube-api";
|
||||
|
||||
@autobind()
|
||||
export class PodDisruptionBudget extends KubeObject {
|
||||
static kind = "PodDisruptionBudget";
|
||||
|
||||
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({
|
||||
kind: PodDisruptionBudget.kind,
|
||||
apiBase: "/apis/policy/v1beta1/poddisruptionbudgets",
|
||||
isNamespaced: true,
|
||||
objectConstructor: PodDisruptionBudget,
|
||||
});
|
||||
Reference in new issue
Block a user