Use stable cluster identity instead of cluster name across AKS Desktop
- Dominant language
- TypeScript
- Stars
- 102
- Forks
- 25
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 22
Description
## Problem
AKS Desktop currently treats the kubeconfig/Headlamp context name, and in some Azure paths the Azure cluster name, as a globally unique cluster identity. Cluster names are not globally unique: managed AKS, AKS Automatic, Arc-connected AKS Hybrid & Edge, and clusters in different subscriptions or resource groups can share a name. Imported kubeconfig contexts can also collide.
This can make name-only lookups resolve the wrong Headlamp context or Azure resource. The Hybrid & Edge work in #782 exposes another collision case, but the limitation is not specific to that feature.
Known name-only paths include project creation and namespace operations, cluster accessibility probes, `useAzureContext` / `getClusterInfo`, deployment, and pipeline configuration.
## Proposed direction
- Define a stable structured cluster identity. For Azure resources, prefer the full ARM resource ID and retain provider type, subscription, resource group, and Azure resource name.
- Give each registered Headlamp/kubeconfig context a unique internal identifier; keep the friendly cluster name as display metadata.
- Persist identity metadata in cluster settings and pass it through Azure and Kubernetes operations rather than reconstructing identity from a name.
- Detect ambiguous legacy contexts and provide a migration, reconnect, or explicit-selection path.
- Keep non-Azure/imported clusters supported through a stable unique context identifier.
## Acceptance criteria
- Two managed AKS clusters with the same name can be distinguished across resource groups or subscriptions.
- Managed AKS/AKS Automatic and Arc-connected clusters with the same name, including in the same resource group, cannot be confused.
- Project creation, accessibility checks, namespace operations, deployments, and pipeline configuration target the selected cluster.
- Existing unambiguous registrations continue to work.
- Tests cover duplicate-name Azure resources and legacy ambiguous context handling.
Follow-up from #782.
Contributor guide
Research direction
Start by tracing the selected-cluster identity through the named paths: project creation, namespace operations, accessibility probes, useAzureContext/getClusterInfo, deployment, and pipeline configuration. Check how existing cluster settings represent kubeconfig contexts and Azure resources, then add tests for duplicate-name resources and ambiguous legacy contexts. Done means all listed operations target the selected cluster while unambiguous registrations keep working.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, kubernetes, typescript
- Domain
- cloud, desktop, devops
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100