Commit f4e74272 authored by Daniele Venzano's avatar Daniele Venzano 🏇

Merge branch 'devel/release' into 'master'

Use only IP addresses as keys in node_dict (fixes #62 on github)

See merge request !63
parents 0e3402ef 3a28a13b
...@@ -16,8 +16,9 @@ ...@@ -16,8 +16,9 @@
"""Interface to the low-level Kubernetes API.""" """Interface to the low-level Kubernetes API."""
import logging import logging
from argparse import Namespace from argparse import Namespace
import socket
from typing import Dict, Any, List from typing import Dict, Any, List
import humanfriendly import humanfriendly
import pykube import pykube
...@@ -413,7 +414,7 @@ class KubernetesClient: ...@@ -413,7 +414,7 @@ class KubernetesClient:
nss.cores_total = float(node.obj['status']['allocatable']['cpu']) nss.cores_total = float(node.obj['status']['allocatable']['cpu'])
nss.memory_total = humanfriendly.parse_size(node.obj['status']['allocatable']['memory']) nss.memory_total = humanfriendly.parse_size(node.obj['status']['allocatable']['memory'])
nss.labels = node.obj['metadata']['labels'] nss.labels = node.obj['metadata']['labels']
node_dict[node.name] = nss node_dict[str(socket.gethostbyname(node.name))] = nss
# Get information from all running pods, then accumulate to nodes # Get information from all running pods, then accumulate to nodes
pod_list = pykube.Pod.objects(self.api).filter(namespace=pykube.all).iterator() pod_list = pykube.Pod.objects(self.api).filter(namespace=pykube.all).iterator()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment