mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-01 13:09:31 +01:00
Fix: fix Kubernetes stats in v1.0.0 (#4984)
Co-authored-by: djeinstine <2105133+djeinstine@users.noreply.github.com>
This commit is contained in:
parent
6e9339b14c
commit
65370a7668
@ -71,8 +71,8 @@ export default async function handler(req, res) {
|
||||
let depMem = 0;
|
||||
let depCpu = 0;
|
||||
const podMetrics = await metricsApi
|
||||
.getPodMetrics(namespace, pod.metadata.name)
|
||||
.then((response) => response)
|
||||
.getPodMetrics(namespace, pod.items)
|
||||
.then((response) => response.items)
|
||||
.catch((err) => {
|
||||
// 404 generally means that the metrics have not been populated yet
|
||||
if (err.statusCode !== 404) {
|
||||
@ -81,9 +81,11 @@ export default async function handler(req, res) {
|
||||
return null;
|
||||
});
|
||||
if (podMetrics) {
|
||||
podMetrics.containers.forEach((container) => {
|
||||
depMem += parseMemory(container.usage.memory);
|
||||
depCpu += parseCpu(container.usage.cpu);
|
||||
podMetrics.forEach((metrics) => {
|
||||
metrics.containers.forEach((container) => {
|
||||
depMem += parseMemory(container.usage.memory);
|
||||
depCpu += parseCpu(container.usage.cpu);
|
||||
});
|
||||
});
|
||||
}
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user