diff --git a/README.rst b/README.rst index 37b21f0..cdf4ad1 100644 --- a/README.rst +++ b/README.rst @@ -1,33 +1,18 @@ -Zoe Analytics - Container-based Analytics as a Service +Atos customized version of the Zoe Analytics platform (Container-based Analytics as a Service) ====================================================== -Zoe Analytics provides a simple way to provision any kind of data analytics applications. - -This repository is used for day-to-day, open source development, feel free to fork and contribute. - -Resources: - -- Website: http://zoe-analytics.eu -- Documentation: http://docs.zoe-analytics.eu -- Roadmap: https://github.com/DistributedSystemsGroup/zoe/wiki/RoadMap -- Mailing list: http://www.freelists.org/list/zoe -- Issue tracker: https://github.com/DistributedSystemsGroup/zoe/issues -- Main repo: https://gitlab.eurecom.fr/zoe/main (GitHub is a read-only mirror) - -Zoe applications (ZApps): - -- Check the repositories at: https://gitlab.eurecom.fr/zoe-apps/ +Zoe Analytics provides a simple way to provision any kind of data analytics applications. The Atos customized version is +able to run on a Google Kubernetes Engine (GKE) backend with Ingress / Reverse proxy features and supports the Atos Codex analytics components as ZApps. Zoe is licensed under the terms of the Apache 2.0 license. -Research papers ---------------- -If you are interested in learning more about Zoe and the underling scheduling theory, we published a paper with an experimental evaluation that show the advantages of our techniques. +References +------------------------------------------------------ -The paper can be found on open access `at ArXiv `_. +This customized version is a fork and is based on the Zoe Analytics platform (zoe-analytics.eu) -If you use Zoe Analytics for running your experiments, please do not forget to cite us:: +Feel free to read the paper of the original developers: `at ArXiv `_. @inproceedings{Pace:2017:FSD:3101112.3101126, author = {Pace, Francesco and Venzano, Daniele and Carra, Damiano and Michiardi, Pietro}, @@ -45,4 +30,3 @@ If you use Zoe Analytics for running your experiments, please do not forget to c publisher = {IEEE Press}, address = {Piscataway, NJ, USA}, } - diff --git a/schemas/app_description_schema.json b/schemas/app_description_schema.json index e8339e5..9d95939 100644 --- a/schemas/app_description_schema.json +++ b/schemas/app_description_schema.json @@ -43,6 +43,9 @@ "monitor": { "type": "boolean" }, + "loadBalancer": { + "type": "boolean" + }, "startup_order": { "type": "number", "multipleOf": 1.0 diff --git a/zoe.conf b/zoe.conf new file mode 100644 index 0000000..71dc8ca --- /dev/null +++ b/zoe.conf @@ -0,0 +1,49 @@ +deployment-name = prod1 +dbname = zoe +dbuser = zoeuser +#postgres +dbpass = zoeuser +dbhost = 127.0.0.1 +dbport = 5432 +api-listen-uri = tcp://0.0.0.0:4850 +#kairosdb-url = http://localhost:8090 +#influxdb-url = http://localhost:8086 +workspace-base-path = /mnt/stateful_partition/zoe-workspaces +workspace-deployment-path = default +overlay-network-name = zoe +gelf-address = +gelf-listener = 7896 +service-logs-base-path = /var/lib/zoe/service-logs +#log-url = https://cloud-platform.eurecom.fr/zoe-logs/ +listen-address = 0.0.0.0 +listen-port = 80 +master-url = tcp://127.0.0.1:4850 +cookie-secret = changeme +auth-file = zoepass.csv +ldap-server-uri = ldap://localhost +ldap-bind-user = ou=something,dc=any,dc=local +ldap-bind-password = mysecretpassword +ldap-base-dn = ou=something,dc=any,dc=local +oauth-redirect-uri = https://my.zoe.com/api/v7/user/oauth +oauth-role = user +oauth-quota = default +oauth-create-workspace-script = /usr/local/bin/zoe_create_workspace.sh +fs-group-id = 5001 +proxy-path = 127.0.0.1 +#reverse-proxy-path = +#websocket_base = ws://{{ server_address }} +#traefik-base-url = /zoe/proxy/ +scheduler-class = ZoeElasticScheduler +scheduler-policy = FIFO +placement-policy = average +backend = Kubernetes +backend-docker-config-file = docker.conf +kube-config-file = /root/.kube/config +kube-namespace = default +kube-ingress-controller = yes +kube-ingress-url-suffix = .platform.atosdigital.nl +zapp-shop-path = /var/lib/zoe-apps +log-file = stderr +max-core-limit = 16 +max-memory-limit = 64 +#additional-volumes = temp diff --git a/zoe_api/api_endpoint.py b/zoe_api/api_endpoint.py index 5198260..1590697 100644 --- a/zoe_api/api_endpoint.py +++ b/zoe_api/api_endpoint.py @@ -217,6 +217,10 @@ def execution_endpoints(self, user: zoe_lib.state.User, execution: zoe_lib.state endpoint_ext = '{}/{}'.format(zoe_lib.config.get_conf().traefik_base_url, port.proxy_key()) endpoint = port.url_template.format(**{"ip_port": port.external_ip + ":" + str(port.external_port), "proxy_path": endpoint_ext}) endpoints.append((port.readable_name, endpoint, endpoint_ext)) + if get_conf().kube_ingress_controller.upper() == 'YES' and port.enable_proxy: + endpoint = port.url_template.format(**{"ip_port": str(service.name) + "-" + str(execution.id) + "-" + get_conf().deployment_name + get_conf().kube_ingress_url_suffix, "proxy_path": ""}) + endpoint_ext = port.url_template.format(**{"ip_port": str(service.name) + "-" + str(execution.id) + "-" + get_conf().deployment_name + get_conf().kube_ingress_url_suffix, "proxy_path": ""}) + endpoints.append((port.readable_name, endpoint, endpoint_ext)) return services_info, endpoints diff --git a/zoe_lib/config.py b/zoe_lib/config.py index d385011..8b231ab 100644 --- a/zoe_lib/config.py +++ b/zoe_lib/config.py @@ -120,6 +120,10 @@ def load_configuration(test_conf=None): argparser.add_argument('--kube-config-file', help='Kubernetes configuration file', default='/opt/zoe/kube.conf') argparser.add_argument('--kube-namespace', help='The namespace that Zoe operates on', default='default') + # Kubernetes Ingress Controller (NGINX) + argparser.add_argument('--kube-ingress-controller', help='Kubernetes Ingress controller is used. Impacts the endpoint handling in Zoe', default='no') + argparser.add_argument('--kube-ingress-url-suffix', help='URL suffix, for subdomain based ingress reverse proxy routing. Impacts endpoint URL creation', default='platform.atosdigital.nl') + # other options argparser.add_argument('--zapp-shop-path', help='Path where ZApp folders are stored', default='/var/lib/zoe-apps') argparser.add_argument('--log-file', help='output logs to a file', default='stderr') diff --git a/zoe_lib/state/service.py b/zoe_lib/state/service.py index 8a485bc..5ca86d1 100644 --- a/zoe_lib/state/service.py +++ b/zoe_lib/state/service.py @@ -146,6 +146,11 @@ def __init__(self, d, sql_manager): except KeyError: self.work_dir = None + try: + self.load_balancer = self.description['loadBalancer'] + except KeyError: + self.load_balancer = None + try: self.labels = self.description['labels'] except KeyError: diff --git a/zoe_master/backends/kubernetes/api_client.py b/zoe_master/backends/kubernetes/api_client.py index c2108f9..d02946c 100644 --- a/zoe_master/backends/kubernetes/api_client.py +++ b/zoe_master/backends/kubernetes/api_client.py @@ -19,6 +19,8 @@ import socket from typing import Dict, Any, List +import re + import humanfriendly import pykube @@ -33,7 +35,7 @@ ZOE_LABELS = { "app": "zoe", "version": ZOE_VERSION, - "auto-ingress/enabled": "enabled" + "auto-ingress/enabled": "enabled", } @@ -48,6 +50,7 @@ def __init__(self): 'namespace': get_conf().kube_namespace }, 'spec': { + 'type': 'NodePort', 'selector': {}, 'ports': [] }, @@ -62,6 +65,10 @@ def set_labels(self, lbs: dict): for key in lbs: self.conf['metadata']['labels'][key] = lbs[key] + def set_type(self,type): + """Setter to override the service type""" + self.conf['spec']['type'] = type + def set_ports(self, ports): """Setter to set ports""" self.conf['spec']['ports'] = [{} for _ in range(len(ports))] @@ -334,6 +341,11 @@ def spawn_service(self, service_instance: ServiceInstance): if len(service_instance.ports) > 0: config.set_ports(service_instance.ports) + """Handling for having a GCP LoadBalancer based exposure instead of the default nodeport/ingress""" + if service_instance.load_balancer == True: + config.set_labels({'auto-ingress/enabled': 'disabled'}) + config.set_type('LoadBalancer') + config.set_selectors(ZOE_LABELS) config.set_selectors({'service_name': service_instance.name}) @@ -411,7 +423,7 @@ def info(self) -> ClusterStats: # pylint: disable=too-many-locals # Get basic information from nodes for node in node_list: nss = NodeStats(node.name) - nss.cores_total = float(node.obj['status']['allocatable']['cpu']) + nss.cores_total = float(node.obj['status']['allocatable']['cpu'][1]) ## Bug found on GKE nss.memory_total = humanfriendly.parse_size(node.obj['status']['allocatable']['memory']) nss.labels = node.obj['metadata']['labels'] nss.status = 'online' diff --git a/zoe_master/backends/service_instance.py b/zoe_master/backends/service_instance.py index 11c2627..34575c9 100644 --- a/zoe_master/backends/service_instance.py +++ b/zoe_master/backends/service_instance.py @@ -72,6 +72,8 @@ def __init__(self, execution: Execution, service: Service, env_subst_dict): self.image_name = service.image_name + self.load_balancer = service.load_balancer + self.ports = [] for port in service.ports: self.ports.append(BackendPort(port.internal_number, port.protocol))