Compare commits
1 Commits
6f1c51bfd8
...
e0c6884a7b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0c6884a7b |
@@ -150,7 +150,10 @@ export async function createAgentPod(podName: string, userId: string): Promise<v
|
|||||||
const podSpec = createAgentPodSpec(podName, userId)
|
const podSpec = createAgentPodSpec(podName, userId)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await client.createNamespacedPod('agents', podSpec)
|
await client.createNamespacedPod({
|
||||||
|
namespace: 'agents',
|
||||||
|
body: podSpec
|
||||||
|
})
|
||||||
console.log(`✅ Pod ${podName} created successfully`)
|
console.log(`✅ Pod ${podName} created successfully`)
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error(`❌ Failed to create pod ${podName}:`, error.message)
|
console.error(`❌ Failed to create pod ${podName}:`, error.message)
|
||||||
@@ -165,11 +168,14 @@ export async function deleteAgentPod(podName: string): Promise<void> {
|
|||||||
const client = getK8sClient()
|
const client = getK8sClient()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await client.deleteNamespacedPod(podName, 'agents')
|
await client.deleteNamespacedPod({
|
||||||
|
name: podName,
|
||||||
|
namespace: 'agents'
|
||||||
|
})
|
||||||
console.log(`✅ Pod ${podName} deleted successfully`)
|
console.log(`✅ Pod ${podName} deleted successfully`)
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
// Ignore 404 errors (pod already deleted)
|
// 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)`)
|
console.log(`⚠️ Pod ${podName} not found (already deleted)`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -185,10 +191,13 @@ export async function getPodStatus(podName: string): Promise<string | null> {
|
|||||||
const client = getK8sClient()
|
const client = getK8sClient()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await client.readNamespacedPod(podName, 'agents')
|
const response = await client.readNamespacedPod({
|
||||||
|
name: podName,
|
||||||
|
namespace: 'agents'
|
||||||
|
})
|
||||||
return response.body.status?.phase || null
|
return response.body.status?.phase || null
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
if (error.statusCode === 404) {
|
if (error.statusCode === 404 || error.response?.statusCode === 404) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
throw error
|
throw error
|
||||||
|
|||||||
Reference in New Issue
Block a user