mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-02 05:23:39 +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 depMem = 0;
|
||||||
let depCpu = 0;
|
let depCpu = 0;
|
||||||
const podMetrics = await metricsApi
|
const podMetrics = await metricsApi
|
||||||
.getPodMetrics(namespace, pod.metadata.name)
|
.getPodMetrics(namespace, pod.items)
|
||||||
.then((response) => response)
|
.then((response) => response.items)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
// 404 generally means that the metrics have not been populated yet
|
// 404 generally means that the metrics have not been populated yet
|
||||||
if (err.statusCode !== 404) {
|
if (err.statusCode !== 404) {
|
||||||
@ -81,9 +81,11 @@ export default async function handler(req, res) {
|
|||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
if (podMetrics) {
|
if (podMetrics) {
|
||||||
podMetrics.containers.forEach((container) => {
|
podMetrics.forEach((metrics) => {
|
||||||
depMem += parseMemory(container.usage.memory);
|
metrics.containers.forEach((container) => {
|
||||||
depCpu += parseCpu(container.usage.cpu);
|
depMem += parseMemory(container.usage.memory);
|
||||||
|
depCpu += parseCpu(container.usage.cpu);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user