Skip to content

Commit

Permalink
chore: types
Browse files Browse the repository at this point in the history
  • Loading branch information
lukepolo committed Nov 4, 2024
1 parent 2faf564 commit 4ff062d
Show file tree
Hide file tree
Showing 3 changed files with 444 additions and 492 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
"prepare": "husky"
},
"dependencies": {
"@kubernetes/client-node": "^0.21.0",
"@kubernetes/client-node": "^0.22.0",
"vdf-parser": "^1.2.1",
"ws": "^8.18.0"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@types/node": "^18.19.39",
"@types/node": "^22.8.7",
"eslint": "^9.6.0",
"husky": "^9.0.11",
"jest": "^29.7.0",
Expand All @@ -35,7 +35,7 @@
"npm-run-all": "^4.1.5",
"prettier": "^3.3.2",
"pretty-quick": "^4.0.0",
"rimraf": "^5.0.9",
"rimraf": "^6.0.1",
"ts-jest": "^29.2.2",
"ts-node": "^10.9.2",
"typescript": "^5.5.3",
Expand Down
11 changes: 6 additions & 5 deletions src/kubernetes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
CoreV1Api,
HttpError,
KubeConfig,
Metrics,
PodMetric,
Expand Down Expand Up @@ -68,10 +69,10 @@ export async function getNodeStats() {
metrics,
};
} catch (error) {
if (error?.response?.status !== 404) {
if (error instanceof HttpError && error.statusCode !== 404) {
console.error(
"Error getting node metrics:",
error?.response?.body || error.message,
error?.body || error.message,
);
}
}
Expand Down Expand Up @@ -111,17 +112,17 @@ export async function getPodStats() {
metrics,
});
} catch (error) {
if (error?.response?.status !== 404) {
if (error instanceof HttpError && error?.statusCode !== 404) {
console.error(
"Error getting pod metrics:",
error?.response?.body || error.message,
error?.body || error.message,
);
}
}
}

return stats;
} catch (error) {
console.error("Error listing pods:", error.message);
console.error("Error listing pods:", error);
}
}
Loading

0 comments on commit 4ff062d

Please sign in to comment.