From 839a76e6393667ff7cdc839d0c9f289eb6058237 Mon Sep 17 00:00:00 2001 From: gitstart Date: Thu, 14 Sep 2023 15:36:25 +0000 Subject: [PATCH] Sort cluster list by label column Signed-off-by: gitstart --- packages/core/src/main/cluster/manager.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/src/main/cluster/manager.ts b/packages/core/src/main/cluster/manager.ts index e49293de8e..d0ef0e1054 100644 --- a/packages/core/src/main/cluster/manager.ts +++ b/packages/core/src/main/cluster/manager.ts @@ -88,7 +88,10 @@ export class ClusterManager { protected updateCatalog(clusters: Cluster[]) { this.dependencies.logger.debug("[CLUSTER-MANAGER]: updating catalog from cluster store"); - for (const cluster of clusters) { + // Sort clusters based on the path of the kubeconfig file + const sortedClusters = [...clusters].sort((a, b) => a.kubeConfigPath.get().localeCompare(b.kubeConfigPath.get())); + + for (const cluster of sortedClusters) { this.updateEntityFromCluster(cluster); } }