Skip to content

Commit

Permalink
node to nodes
Browse files Browse the repository at this point in the history
Signed-off-by: Auto User <[email protected]>
  • Loading branch information
Auto User committed Sep 4, 2024
1 parent cefdd4b commit ef5d9b0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/krkn_lib/k8s/krkn_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2084,19 +2084,19 @@ def get_nodes_infos(self) -> (list[NodeInfo], list[Taint]):
node_info.instance_type = "unknown"

if node_type_infra_label in node.metadata.labels.keys():
node_info.node_type = "infra"
node_info.nodes_type= "infra"
elif node_type_worker_label in node.metadata.labels.keys():
node_info.node_type = "worker"
node_info.nodes_type= "worker"
elif node_type_master_label in node.metadata.labels.keys():
node_info.node_type = "master"
node_info.nodes_type= "master"
elif node_type_workload_label in node.metadata.labels.keys():
node_info.node_type = "workload"
node_info.nodes_type= "workload"
elif (
node_type_application_label in node.metadata.labels.keys()
):
node_info.node_type = "application"
node_info.nodes_type= "application"
else:
node_info.node_type = "unknown"
node_info.nodes_type= "unknown"

node_info.architecture = node.status.node_info.architecture
node_info.architecture = node.status.node_info.architecture
Expand Down
10 changes: 5 additions & 5 deletions src/krkn_lib/models/telemetry/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class NodeInfo:
"""
Cloud instance type (if available)
"""
node_type: str = ""
nodes_type: str = ""
"""
Node Type (worker/infra/master etc.)
"""
Expand All @@ -162,8 +162,8 @@ def __init__(self, json_dict: dict = None):
if "instance_type" in json_dict
else None
)
self.node_type = (
json_dict["node_type"] if "node_type" in json_dict else None
self.nodes_type = (
json_dict["nodes_type"] if "nodes_type" in json_dict else None
)
self.kernel_version = (
json_dict["kernel_version"]
Expand All @@ -184,7 +184,7 @@ def __eq__(self, other):
return (
other.architecture == self.architecture
and other.instance_type == self.instance_type
and other.node_type == self.node_type
and other.nodes_type == self.nodes_type
and other.kernel_version == self.kernel_version
and other.kubelet_version == self.kubelet_version
and other.os_version == self.os_version
Expand All @@ -195,7 +195,7 @@ def __eq__(self, other):
def __repr__(self):
return (
f"{self.architecture} {self.instance_type} "
f"{self.node_type} {self.kernel_version} "
f"{self.nodes_type} {self.kernel_version} "
f"{self.kubelet_version} {self.os_version}"
)

Expand Down
2 changes: 1 addition & 1 deletion src/krkn_lib/tests/test_krkn_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ def test_get_nodes_infos(self):
nodes, _ = self.lib_k8s.get_nodes_infos()
for node in nodes:
self.assertTrue(node.count > 0)
self.assertTrue(node.node_type)
self.assertTrue(node.nodes_type)
self.assertTrue(node.architecture)
self.assertTrue(node.instance_type)
self.assertTrue(node.os_version)
Expand Down

0 comments on commit ef5d9b0

Please sign in to comment.