Commit Graph

11 Commits

Author SHA1 Message Date
Hector Ros
6864258810 Fix getPodIP: handle different K8s API response structures
All checks were successful
Build and Push Backend / build (push) Successful in 6s
- Add debug logging to getPodIP
- Handle both response.body and direct response
- Apply same fix to getPodStatus for consistency
- Fixes 500 error when accessing agent terminal
2026-01-20 19:56:04 +01:00
Hector Ros
209b439d26 Fix terminal proxy: use pod IP instead of non-existent DNS
All checks were successful
Build and Push Backend / build (push) Successful in 6s
- Add getPodIP() function to get pod IP from K8s API
- Update terminal proxy to use pod IP directly
- Add logging for proxy requests
- Fixes terminal showing black screen issue
2026-01-20 18:50:08 +01:00
Hector Ros
3fef6030ea Fix: Handle undefined result.body.metadata gracefully
All checks were successful
Build and Push Backend / build (push) Successful in 5s
Pod creation succeeds but response structure may not have metadata.
Add safe navigation to prevent error.

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-20 18:35:21 +01:00
Hector Ros
65b18d13b5 Fix: Pass HTTPS agent as request option directly
All checks were successful
Build and Push Backend / build (push) Successful in 11s
applyToHTTPSOptions doesn't work reliably. Instead, pass the
httpsAgent as the last parameter to createNamespacedPod.

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-20 18:17:30 +01:00
Hector Ros
9eb9def85c Add extensive debug logging for K8s client
All checks were successful
Build and Push Backend / build (push) Successful in 4s
- Log cluster config details
- Log HTTPS agent setup
- Log detailed error information on pod creation failure
- Track applyToHTTPSOptions execution

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-20 18:13:59 +01:00
Hector Ros
697ee1b426 Fix: Use custom HTTPS agent to skip SSL verification
All checks were successful
Build and Push Backend / build (push) Successful in 4s
skipTLSVerify flag is not respected by @kubernetes/client-node.
Solution: Create custom https.Agent with rejectUnauthorized: false

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-20 18:10:17 +01:00
Hector Ros
3bc59dc964 Fix: Apply skipTLSVerify in loadFromCluster mode
All checks were successful
Build and Push Backend / build (push) Successful in 5s
When K8S_IN_CLUSTER=true, backend uses loadFromCluster() which needs
skipTLSVerify to work with self-signed cluster certificates.

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-20 17:57:23 +01:00
Hector Ros
14ae28f13c Add TLS skip for K8s client when in-cluster
All checks were successful
Build and Push Backend / build (push) Successful in 4s
- Configure skipTLSVerify for cluster certificates
- Better handling of in-cluster vs out-of-cluster modes

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-20 17:53:04 +01:00
Hector Ros
e0c6884a7b Fix K8s API calls: use param object format
All checks were successful
Build and Push Backend / build (push) Successful in 5s
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) <noreply@anthropic.com>
2026-01-20 17:48:56 +01:00
Hector Ros
6f1c51bfd8 Fix K8s pod creation: use correct V1Pod format
All checks were successful
Build and Push Backend / build (push) Successful in 4s
- Remove apiVersion and kind from pod spec (not needed for client-node)
- Remove namespace from metadata (passed as parameter)
- Use proper V1Pod type from @kubernetes/client-node

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-20 17:37:38 +01:00
Hector Ros
f104425b91 Implement Kubernetes pod management for agents
All checks were successful
Build and Push Backend / build (push) Successful in 5s
- Add @kubernetes/client-node dependency
- Create K8s client utilities in src/lib/k8s.ts
- Implement createAgentPod and deleteAgentPod functions
- Update launchAgent to actually create pods in K8s
- Update unregisterAgent to delete pods from K8s
- Initialize K8s client on backend startup
- Add rollback logic if pod creation fails

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-20 17:34:10 +01:00