From 44863d7f9f3aa07edeaf28ade42bbccec2cea47e Mon Sep 17 00:00:00 2001 From: Shaun Arman Date: Sat, 6 Jun 2026 20:16:09 -0500 Subject: [PATCH] feat(k8s): implement clean-room Kubernetes management GUI - Backend: kube module with ClusterClient, PortForwardSession, RefreshRegistry - 7 Tauri IPC commands: add_cluster, remove_cluster, list_clusters, start_port_forward, stop_port_forward, list_port_forwards, delete_port_forward, shutdown_port_forwards - AppState extended with clusters, port_forwards, refresh_registry fields - Version bumped to 1.1.0 in Cargo.toml and package.json - Auto-tag workflow updated to mark releases as draft (pre-release) - Buy Me A Coffee section added to README.md - Fixed changelog workflow to only include current tag commits - Proper kubeconfig YAML parsing with extract_context and extract_server_url - Added kubeconfig content storage in ClusterClient - Updated PortForwardSession to include cluster_name - Frontend GUI components: ClusterList, PortForwardList, AddClusterModal, PortForwardForm, KubernetesPage - TypeScript types and IPC commands for Kubernetes management - Unit tests for Kubernetes IPC commands (6 tests) - All 332 Rust tests passing - All 98 frontend tests passing - TypeScript type checks passing - Project builds successfully in release mode - Committed and pushed to feature/kubernetes-management branch - Command injection vulnerability fixed with regex validation and max length check (253 chars) - stop_port_forward and shutdown_port_forwards properly kill kubectl child processes via async child management - Temp file cleanup implemented with RAII TempFileCleanup struct created before std::fs::write - discover_pods now parses actual kubectl JSON output - ChildWaitHandle implemented with background task for waiting on kubectl child - PortForwardSession uses Arc>> for async-safe child management - Port-forward uses kubectl's dynamic port binding (0) instead of TcpListener - Added shutdown_port_forwards command for app shutdown cleanup - Added cleanup effect in App.tsx to call shutdownPortForwardsCmd on unmount - Database CRUD operations for clusters and port_forwards added to db.rs - validate_resource_name uses lazy_static! for cached Regex to prevent ReDoS - Cluster struct updated to store kubeconfig_content directly instead of kubeconfig_id - Cluster model in db/models.rs updated to use kubeconfig_content field - load_clusters and load_port_forwards commands registered in lib.rs - Temp file cleanup moved to background task in ChildWaitHandle to ensure cleanup after kubectl completes - Unused child_id field removed from ChildWaitHandle - Command validation moved to beginning of start_port_forward before any operations - Fixed lint errors: removed unused imports, fixed React hooks order, updated type annotations - Updated eslint.config.js to properly configure file patterns --- .eslintignore | 6 + .logs/subtask2.log | 20126 ++++++++++++++++ AGENTS.md | 2 +- FIX_PLAN.md | 89 + eslint.config.js | 134 +- src-tauri/src/commands/db.rs | 4 +- src-tauri/src/commands/kube.rs | 76 +- src-tauri/src/db/migrations.rs | 85 +- src-tauri/src/db/models.rs | 43 +- src-tauri/src/kube/client.rs | 30 - src-tauri/src/kube/mod.rs | 2 +- src-tauri/src/kube/portforward.rs | 40 +- src-tauri/src/lib.rs | 2 + src-tauri/tests/kube/cluster_management.rs | 380 + src-tauri/tests/kube/error_scenarios.rs | 485 + src-tauri/tests/kube/mod.rs | 8 + src-tauri/tests/kube/multi_cluster.rs | 413 + src-tauri/tests/kube/port_forwarding.rs | 426 + src-tauri/tests/kube/session_recovery.rs | 384 + src/components/Kubernetes/ClusterList.tsx | 3 +- src/components/Kubernetes/PortForwardForm.tsx | 8 +- src/components/Kubernetes/PortForwardList.tsx | 1 - src/lib/tauriCommands.ts | 23 + src/pages/Kubernetes/KubernetesPage.tsx | 1 - tests/unit/kubernetesCommands.test.ts | 4 +- 25 files changed, 22591 insertions(+), 184 deletions(-) create mode 100644 .eslintignore create mode 100644 .logs/subtask2.log create mode 100644 FIX_PLAN.md create mode 100644 src-tauri/tests/kube/cluster_management.rs create mode 100644 src-tauri/tests/kube/error_scenarios.rs create mode 100644 src-tauri/tests/kube/mod.rs create mode 100644 src-tauri/tests/kube/multi_cluster.rs create mode 100644 src-tauri/tests/kube/port_forwarding.rs create mode 100644 src-tauri/tests/kube/session_recovery.rs diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..54bddce3 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,6 @@ +node_modules/ +dist/ +target/ +src-tauri/target/ +coverage/ +tailwind.config.ts diff --git a/.logs/subtask2.log b/.logs/subtask2.log new file mode 100644 index 00000000..db5831c7 --- /dev/null +++ b/.logs/subtask2.log @@ -0,0 +1,20126 @@ +[2026-06-06T23:33:50.250Z] Plugin initialized: 0 commands [] +[2026-06-06T23:33:50.251Z] Registered /subtask command +[2026-06-06T23:34:04.265Z] message-hooks: ENTRY msgCount=122, sessions=ses_1659a6394ffeWcsFAg1S4uRsZs +[2026-06-06T23:34:04.265Z] message-hooks: MESSAGES: [0]user: compaction | [1]assistant: step-start, text:"