cluster: include overcommitted namespaces
This commit is contained in:
parent
ccf89bc2e7
commit
ef2ede2443
@ -1579,8 +1579,18 @@ def _namespace_capacity_summary(capacity: list[dict[str, Any]]) -> dict[str, Any
|
|||||||
)
|
)
|
||||||
cpu_headroom.sort(key=lambda item: (item.get("headroom") or 0))
|
cpu_headroom.sort(key=lambda item: (item.get("headroom") or 0))
|
||||||
mem_headroom.sort(key=lambda item: (item.get("headroom") or 0))
|
mem_headroom.sort(key=lambda item: (item.get("headroom") or 0))
|
||||||
over_cpu = sum(1 for entry in cpu_ratio if (entry.get("cpu_usage_ratio") or 0) > 1)
|
cpu_over_names = [
|
||||||
over_mem = sum(1 for entry in mem_ratio if (entry.get("mem_usage_ratio") or 0) > 1)
|
entry.get("namespace")
|
||||||
|
for entry in cpu_ratio
|
||||||
|
if (entry.get("cpu_usage_ratio") or 0) > 1 and entry.get("namespace")
|
||||||
|
]
|
||||||
|
mem_over_names = [
|
||||||
|
entry.get("namespace")
|
||||||
|
for entry in mem_ratio
|
||||||
|
if (entry.get("mem_usage_ratio") or 0) > 1 and entry.get("namespace")
|
||||||
|
]
|
||||||
|
over_cpu = len(cpu_over_names)
|
||||||
|
over_mem = len(mem_over_names)
|
||||||
return {
|
return {
|
||||||
"cpu_ratio_top": cpu_ratio[:_NAMESPACE_TOP_COUNT],
|
"cpu_ratio_top": cpu_ratio[:_NAMESPACE_TOP_COUNT],
|
||||||
"mem_ratio_top": mem_ratio[:_NAMESPACE_TOP_COUNT],
|
"mem_ratio_top": mem_ratio[:_NAMESPACE_TOP_COUNT],
|
||||||
@ -1588,6 +1598,8 @@ def _namespace_capacity_summary(capacity: list[dict[str, Any]]) -> dict[str, Any
|
|||||||
"mem_headroom_low": mem_headroom[:_NAMESPACE_TOP_COUNT],
|
"mem_headroom_low": mem_headroom[:_NAMESPACE_TOP_COUNT],
|
||||||
"cpu_overcommitted": over_cpu,
|
"cpu_overcommitted": over_cpu,
|
||||||
"mem_overcommitted": over_mem,
|
"mem_overcommitted": over_mem,
|
||||||
|
"cpu_overcommitted_names": sorted({name for name in cpu_over_names if isinstance(name, str)}),
|
||||||
|
"mem_overcommitted_names": sorted({name for name in mem_over_names if isinstance(name, str)}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user