Fix kubernetes services incorrectly marked as down

the "in" operator works differently in JavaScript
This commit is contained in:
Qasim Mehmood 2024-07-18 11:00:07 +05:00 committed by GitHub
parent d6188e52fe
commit 7d13ce2951
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,8 +48,8 @@ export default async function handler(req, res) {
logger.error(`no pods found with namespace=${namespace} and labelSelector=${labelSelector}`); logger.error(`no pods found with namespace=${namespace} and labelSelector=${labelSelector}`);
return; return;
} }
const someReady = pods.find((pod) => pod.status.phase in ["Completed", "Running"]); const someReady = pods.find((pod) => ["Completed", "Running"].includes(pod.status.phase));
const allReady = pods.every((pod) => pod.status.phase in ["Completed", "Running"]); const allReady = pods.every((pod) => ["Completed", "Running"].includes(pod.status.phase));
let status = "down"; let status = "down";
if (allReady) { if (allReady) {
status = "running"; status = "running";