Skip to content

Commit

Permalink
fix(k8s): attempt execing on running pod
Browse files Browse the repository at this point in the history
  • Loading branch information
stefreak committed Feb 26, 2024
1 parent 75dfcd1 commit 37a168c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/plugins/kubernetes/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,14 @@ export async function execInWorkload({
const api = await KubeApi.factory(log, ctx, provider)
const pods = await getCurrentWorkloadPods(api, namespace, workload)

const pod = pods[0]
const runningPods = pods.filter((p) => checkPodStatus(p) === "ready")
if (runningPods.length === 0) {
throw new DeploymentError({
message: `No running pods found for ${getResourceKey(workload)}`,
})
}

const pod = sample(runningPods)

if (!pod) {
// This should not happen because of the prior status check, but checking to be sure
Expand Down

0 comments on commit 37a168c

Please sign in to comment.