Removing some TODO types

This commit is contained in:
Eric Herbrandson
2020-08-19 22:41:12 -05:00
parent cfb24de72b
commit e0604589fa
4 changed files with 69 additions and 39 deletions

View File

@@ -65,8 +65,8 @@ export function getNodeUsage(node: Node, metrics: _.Dictionary<Metrics>, resourc
// Pod helpers
export function getPodResourcePercent(
pod: Pod,
metrics: _.Dictionary<Metrics>,
pod: Pod | undefined,
metrics: _.Dictionary<Metrics> | undefined,
resource: ResourceType,
type: string,
) {
@@ -75,7 +75,11 @@ export function getPodResourcePercent(
return actual ? actual / request : null;
}
export function getPodUsage(pod: Pod, metrics: _.Dictionary<Metrics>, resource: ResourceType) {
export function getPodUsage(
pod: Pod | undefined,
metrics: _.Dictionary<Metrics> | undefined,
resource: ResourceType,
) {
if (!pod || !metrics) return undefined;
const metric = metrics[pod.metadata.name] || {};

View File

@@ -109,6 +109,10 @@ export interface K8sEvent extends ApiItem<undefined, undefined> {
involvedObject: InvolvedObject;
}
interface ContainerStatus {
restartCount: number;
}
interface PodSpec {
nodeName: string;
containers: Container[];
@@ -122,6 +126,7 @@ interface PodStatus {
qosClass: string;
message: string;
conditions?: Condition[];
containerStatuses: ContainerStatus[];
}
export interface Pod extends ApiItem<PodSpec, PodStatus>{

View File

@@ -65,7 +65,8 @@ export function parseCpu(value?: string) {
return number * 1000 * 1000 * 1000;
}
export function unparseCpu(value: string) {
export function unparseCpu(value: string | number) {
// @ts-ignore
const result = parseFloat(value);
return {