Commit 0e3402ef authored by Daniele Venzano's avatar Daniele Venzano 🏇
Browse files

Merge branch 'devel/release' into 'master'

Remove left-over code in Kubernetes package (fixes #61 on github)

See merge request !62
parents da0c97e8 41c6cdf4
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
set -e set -e
pylint *.py zoe_* tests/*.py pylint *.py zoe_*
pytest --ignore integration_tests --tb=short --cov-report=term --cov zoe_api --cov zoe_master --cov zoe_lib pytest --ignore integration_tests --tb=short --cov-report=term --cov zoe_api --cov zoe_master --cov zoe_lib
doc8 docs/ doc8 docs/
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
"""Interface to the low-level Kubernetes API.""" """Interface to the low-level Kubernetes API."""
import logging import logging
import json
import time
from argparse import Namespace from argparse import Namespace
from typing import Dict, Any, List from typing import Dict, Any, List
...@@ -34,16 +32,9 @@ log = logging.getLogger(__name__) ...@@ -34,16 +32,9 @@ log = logging.getLogger(__name__)
ZOE_LABELS = { ZOE_LABELS = {
"app": "zoe", "app": "zoe",
"version": ZOE_VERSION, "version": ZOE_VERSION,
"auto-ingress/enabled" : "enabled" "auto-ingress/enabled": "enabled"
} }
class KubernetesConf:
"""Kubeconfig class"""
def __init__(self, jsonfile):
self.config = {}
with open(jsonfile, 'r') as inp:
self.config = json.load(inp)
class KubernetesServiceConf: class KubernetesServiceConf:
""" Wrapper for Kubernetes Service configuration """ """ Wrapper for Kubernetes Service configuration """
...@@ -230,10 +221,7 @@ class KubernetesReplicationControllerConf: ...@@ -230,10 +221,7 @@ class KubernetesReplicationControllerConf:
class KubernetesClient: class KubernetesClient:
"""The Kubernetes client class that wraps the Kubernetes API.""" """The Kubernetes client class that wraps the Kubernetes API."""
def __init__(self, opts: Namespace) -> None: def __init__(self, opts: Namespace) -> None:
#try:
self.api = pykube.HTTPClient(pykube.KubeConfig.from_file(opts.kube_config_file)) self.api = pykube.HTTPClient(pykube.KubeConfig.from_file(opts.kube_config_file))
#except Exception as e:
# log.error(e)
def spawn_replication_controller(self, service_instance: ServiceInstance): def spawn_replication_controller(self, service_instance: ServiceInstance):
"""Create and start a new replication controller.""" """Create and start a new replication controller."""
...@@ -449,19 +437,7 @@ class KubernetesClient: ...@@ -449,19 +437,7 @@ class KubernetesClient:
cpu_float = int(cpu_splitted[0]) cpu_float = int(cpu_splitted[0])
nss.cores_reserved = round(nss.cores_reserved + cpu_float, 3) nss.cores_reserved = round(nss.cores_reserved + cpu_float, 3)
cont_total = 0
mem_total = 0
cpu_total = 0
for node_ip in node_dict: for node_ip in node_dict:
pl_status.nodes.append(node_dict[node_ip]) pl_status.nodes.append(node_dict[node_ip])
cont_total = cont_total + node_dict[node_ip].container_count
mem_total = mem_total + node_dict[node_ip].memory_total
cpu_total = cpu_total + node_dict[node_ip].cores_total
pl_status.container_count = cont_total
pl_status.memory_total = mem_total
pl_status.cores_total = cpu_total
pl_status.timestamp = time.time()
return pl_status return pl_status
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