Skip to content

Commit

Permalink
Stop trying to get status when pod not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
patuwwy committed Mar 14, 2024
1 parent 789eda4 commit 89dcffa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/adapters/src/kubernetes-client-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ class KubernetesClientAdapter {
this.logger.error(`Status for "${podName}" pod responded with error`, err?.body?.message);

if (err.statusCode === 404) {
this.logger.error("You have deleted this pod already! Try to increase runnerExitDelay in CSIController.");
this.logger.error("Pod not found", podName);
throw Error("Pod not found");
}
} else {
this.logger.error(`Failed to get pod status: ${podName}.`, err);
Expand Down
4 changes: 4 additions & 0 deletions packages/host/src/lib/csi-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,10 @@ export class CSIController extends TypedEmitter<Events> {
}

private async handleKill(req: ParsedMessage): Promise<OpResponse<STHRestAPI.SendKillInstanceResponse>> {
if (this.status !== InstanceStatus.RUNNING) {
return { opStatus: ReasonPhrases.BAD_REQUEST, error: "Instance not running" };
}

const { body: { removeImmediately = false } = { removeImmediately: false } } = req;

if (typeof removeImmediately !== "boolean")
Expand Down

0 comments on commit 89dcffa

Please sign in to comment.