From e0c6884a7b00823146629e506a197a2dc7bd7919 Mon Sep 17 00:00:00 2001 From: Hector Ros Date: Tue, 20 Jan 2026 17:48:56 +0100 Subject: [PATCH] Fix K8s API calls: use param object format The @kubernetes/client-node API expects parameters as an object: { namespace: 'ns', body: pod } instead of positional params. Co-Authored-By: Claude Sonnet 4.5 (1M context) --- src/lib/k8s.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lib/k8s.ts b/src/lib/k8s.ts index 9e91db0..4bb7452 100644 --- a/src/lib/k8s.ts +++ b/src/lib/k8s.ts @@ -150,7 +150,10 @@ export async function createAgentPod(podName: string, userId: string): Promise { const client = getK8sClient() try { - await client.deleteNamespacedPod(podName, 'agents') + await client.deleteNamespacedPod({ + name: podName, + namespace: 'agents' + }) console.log(`✅ Pod ${podName} deleted successfully`) } catch (error: any) { // Ignore 404 errors (pod already deleted) - if (error.statusCode === 404) { + if (error.statusCode === 404 || error.response?.statusCode === 404) { console.log(`⚠️ Pod ${podName} not found (already deleted)`) return } @@ -185,10 +191,13 @@ export async function getPodStatus(podName: string): Promise { const client = getK8sClient() try { - const response = await client.readNamespacedPod(podName, 'agents') + const response = await client.readNamespacedPod({ + name: podName, + namespace: 'agents' + }) return response.body.status?.phase || null } catch (error: any) { - if (error.statusCode === 404) { + if (error.statusCode === 404 || error.response?.statusCode === 404) { return null } throw error