Add cluster name for the mothership, small UI fixes
Related-PROD: K0RQA-20
Change-Id: Ia7c8a9e20fc28d0484a17ea4c8073193817e0f9f
diff --git a/cfg_checker/common/kube_utils.py b/cfg_checker/common/kube_utils.py
index 36efcaa..eb355ab 100644
--- a/cfg_checker/common/kube_utils.py
+++ b/cfg_checker/common/kube_utils.py
@@ -313,6 +313,17 @@
f"Failed to get the k0rdent release from the '{mgmt_name}' mgmt CRD: {e}")
return "Unknown"
+ def get_cluster_name_from_kube_config(self):
+ try:
+ with open(self.kConfigPath.split(":")[1], "r") as f:
+ config = yaml.safe_load(f)
+ clusters = config.get("clusters", [])
+ return clusters[0].get("name")
+ except Exception as e:
+ logger.warning(
+ f"Failed to get the cluster name from the loaded kubeconfig: {e}")
+ return ""
+
def get_node_info(self, http=False):
# Query API for the nodes and do some presorting
_nodes = {}