Improved handling of empty or disabled kubernetes configuration

This commit is contained in:
James Wynn committed 2022-11-06 06:58:52 -06:00
1 parent 0c6f7dbee1
commit 056e26dfd3
5 files changed
+24 -1

No files matched your search

@@ -21,6 +21,12 @@ export default async function handler(req, res) {
try {
const kc = getKubeConfig();
if (!kc) {
res.status(500).send({
error: "No kubernetes configuration"
});
return;
}
const coreApi = kc.makeApiClient(CoreV1Api);
const metricsApi = new Metrics(kc);
const podsResponse = await coreApi.listNamespacedPod(namespace, null, null, null, null, labelSelector)