fix: dev pod state logic should prioritize actual pod status over replica spec
Some checks failed
Build & Release / build (push) Has been cancelled
Some checks failed
Build & Release / build (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,11 +29,14 @@ export async function devpodRoutes(app: FastifyInstance) {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// Determine overall state
|
// Determine overall state
|
||||||
|
const hasRunningPods = pods.some((p: any) => p.ready);
|
||||||
|
const hasFailedPods = pods.some((p: any) => p.status === "Failed");
|
||||||
let state: "stopped" | "running" | "starting" | "error";
|
let state: "stopped" | "running" | "starting" | "error";
|
||||||
if (replicas === 0) state = "stopped";
|
if (hasRunningPods) state = "running";
|
||||||
else if (readyReplicas > 0 && pods.some((p: any) => p.ready)) state = "running";
|
else if (hasFailedPods) state = "error";
|
||||||
else if (pods.some((p: any) => p.status === "Failed")) state = "error";
|
else if (replicas === 0 && pods.length === 0) state = "stopped";
|
||||||
else state = "starting";
|
else if (pods.length > 0) state = "starting";
|
||||||
|
else state = "stopped";
|
||||||
|
|
||||||
return reply.send({ state, replicas, readyReplicas, image, pods });
|
return reply.send({ state, replicas, readyReplicas, image, pods });
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user