Fix: correct k8s service status check (#3753)

This commit is contained in:
shamoon 2024-07-17 23:04:50 -07:00 committed by GitHub
parent d6188e52fe
commit 407376b3b7
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}`);
return;
}
const someReady = pods.find((pod) => pod.status.phase in ["Completed", "Running"]);
const allReady = pods.every((pod) => pod.status.phase in ["Completed", "Running"]);
const someReady = pods.find((pod) => ["Completed", "Running"].includes(pod.status.phase));
const allReady = pods.every((pod) => ["Completed", "Running"].includes(pod.status.phase));
let status = "down";
if (allReady) {
status = "running";