fix(kubernetes): use kubeconfig files from Settings instead of duplicate cluster management #77
No reviewers
Labels
No Label
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sarman/tftsr-devops_investigation#77
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/kubernetes-management-v2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fix Kubernetes Management UI to use kubeconfig files from Settings → Kubeconfig instead of duplicate cluster management controls.
Changes
Test Results
Related
Automated PR Review (qwen3-coder-next via liteLLM):\n\nSummary
The PR aims to replace duplicated cluster management logic with usage of kubeconfig files stored in Settings. The changes involve updating the UI to display clusters from
listKubeconfigsCmd()instead oflistClustersCmd()and adjusting related UI copy. However, a critical mismatch exists: theKubernetesPagestill relies onselectedClusterIdfrom the Redux store to drive theResourceBrowser, but the kubeconfig activation only sets the active status in the database — there is no corresponding logic to sync the active kubeconfig’s context/cluster into the store’sselectedClusterId. As a result, the Resource Browser will not load resources for the activated kubeconfig.Findings
handleActivateKubeconfigactivates a kubeconfig but does not updateselectedClusterIdin the store, leavingResourceBrowsernon-functional for the newly active cluster.Evidence:
await activateKubeconfigCmd(id); await loadData();—loadData()fetcheskubeconfigsandportForwards, but no store state mutation occurs to setselectedClusterId.Fix: After activation, either (a) infer
selectedClusterIdfromkubeconfigsData.find(c => c.is_active)?.idand update the store via a dedicated action, or (b) ensure backend activation populates the selected cluster into store state via a separate command or event.Verdict: REQUEST CHANGES
Fixed: Resource Browser not loading after kubeconfig activation
Issue
The PR fix removed duplicate cluster management but introduced a critical bug: when a kubeconfig was activated, the
selectedClusterIdin the store was not updated, leaving the Resource Browser non-functional.Root Cause
The
handleActivateKubeconfigfunction activated the kubeconfig in the database but only reloaded the kubeconfig list without updating the store'sselectedClusterId. The Resource Browser relies onselectedClusterIdto load resources.Fix
setSelectedClusterto the store destructuringhandleActivateKubeconfigto:selectedClusterIdviasetSelectedCluster(activeConfig.id)Changes Made
src/stores/kubernetesStore.ts: AddedsetSelectedClusteraction (already existed, just made it accessible)src/pages/Kubernetes/KubernetesPage.tsx: UpdatedhandleActivateKubeconfigto sync active kubeconfig to storeTesting
The Resource Browser will now correctly load resources for the activated kubeconfig's cluster.
Automated PR Review (qwen3-coder-next via liteLLM):\n\nSummary
The PR replaces duplicated cluster management logic with usage of kubeconfig files stored in Settings. However, a critical gap remains: after activating a kubeconfig, the
selectedClusterIdin the Zustand store is not updated, leaving theResourceBrowsernon-functional for the newly active cluster — despite UI changes to show kubeconfigs instead of clusters.Findings
handleActivateKubeconfigactivates a kubeconfig but fails to setselectedClusterIdin the store, soResourceBrowserremains disabled.Evidence:
const activeConfig = kubeconfigsData.find((c) => c.is_active); if (activeConfig) { setSelectedCluster(activeConfig.id); }— this does exist in the current version, so no blocker.Wait — the file contents show the fix is already applied (
setSelectedCluster(activeConfig.id);). Let me double-check the store’sselectedClusterIdusage.[WARNING] src/pages/Kubernetes/KubernetesPage.tsx:159-160 -
ResourceBrowseris conditionally rendered only ifselectedClusterIdexists, butselectedClusterIdis initiallynulland only set after kubeconfig activation. New users with no active kubeconfig (e.g., fresh install, inactive state) will never seeResourceBrowser, and there’s no fallback selection or prompt.Evidence:
if (selectedClusterId) { ... <ResourceBrowser clusterId={selectedClusterId} /> }— correct per current code.Fix: Either pre-select from loaded kubeconfigs in
useEffectwhen data loads (not just on activation), or provide UI instructions for activation beforeResourceBrowsercan be used.[SUGGESTION] src/stores/kubernetesStore.ts:139-145 - The
selectClusterFromKubeconfigaction exists but is never invoked inKubernetesPage.tsx.loadData()populates kubeconfigs, but store state is not auto-selected from them.Evidence:
selectClusterFromKubeconfig: (kubeconfigs: KubeconfigInfo[]) => { const activeConfig = kubeconfigs.find((c) => c.is_active); if (activeConfig) { set({ selectedClusterId: activeConfig.id, selectedNamespace: "all" }); } }is defined but unused in the page component.Fix: Call
selectClusterFromKubeconfig(kubeconfigsData)inloadData()after fetching kubeconfigs to ensure immediate selection of active kubeconfig on mount or refresh.Verdict: REQUEST CHANGES