Add state assignment to _to_node()
@@ -104,7 +104,7 @@ class KubernetesContainerDriver(KubernetesDriverMixin, ContainerDriver):
def get_version(self):
"""Get Kubernetes version"""
- return self.connection.request("/version").object['gitVersion']
+ return self.connection.request("/version").object["gitVersion"]
def list_containers(self, image=None, all=True):
"""
@@ -315,7 +315,11 @@ class KubernetesContainerDriver(KubernetesDriverMixin, ContainerDriver):
extra = {"memory": memory, "cpu": cpu}
extra["os"] = data["status"]["nodeInfo"]["operatingSystem"]
extra["kubeletVersion"] = data["status"]["nodeInfo"]["kubeletVersion"]
- # TODO: Find state
+ for condition in data["status"]["conditions"]:
+ if condition["type"] == "Ready" and condition["status"] == "True":
+ state = NodeState.RUNNING
+ break
+ else:
state = NodeState.UNKNOWN
public_ips, private_ips = [], []
for address in data["status"]["addresses"]:
