fix: don't show "partial" if there are completed job pods

i'm using a kubernetes service that includes a web UI and cronjobs.
because the job finish and go to status `Completed`, the homepage link
to the web UI shows `partial` instead of `running`

this patch updates the `someReady` & `allReady` pod filter to include
pods that are both `Running` and `Completed`
This commit is contained in:
Charles Thomas 2024-07-12 17:54:51 -04:00
parent 95ab0706b6
commit 507f2bfafd

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 === "Running");
const allReady = pods.every((pod) => pod.status.phase === "Running");
const someReady = pods.find((pod) => pod.status.phase in ["Completed", "Running"]);
const allReady = pods.every((pod) => pod.status.phase in ["Completed", "Running"]);
let status = "down";
if (allReady) {
status = "running";