Improved handling of empty or disabled kubernetes configuration

This commit is contained in:
James Wynn 2022-10-27 16:53:54 -05:00
parent 0c6f7dbee1
commit 056e26dfd3
5 changed files with 24 additions and 1 deletions

View file

@ -20,6 +20,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 podsResponse = await coreApi.listNamespacedPod(namespace, null, null, null, null, labelSelector)
.then((response) => response.body)