Commit da752d39 authored by Quang-Nhat HOANG-XUAN's avatar Quang-Nhat HOANG-XUAN Committed by GitHub

Merge pull request #84 from DistributedSystemsGroup/kpmg/fix-service-port-name

multiple port, disable checker for k8s
parents fa810e0d 7a2dd9d9
...@@ -77,7 +77,7 @@ class KubernetesServiceConf: ...@@ -77,7 +77,7 @@ class KubernetesServiceConf:
for prt in ports: for prt in ports:
aux = self.conf['spec']['ports'] # type: List[Dict[str, str]] aux = self.conf['spec']['ports'] # type: List[Dict[str, str]]
aux[count]['name'] = 'http' aux[count]['name'] = 'http-' + str(count)
aux[count]['port'] = prt.number aux[count]['port'] = prt.number
aux[count]['targetPort'] = prt.number aux[count]['targetPort'] = prt.number
count += 1 count += 1
...@@ -184,6 +184,13 @@ class KubernetesReplicationControllerConf: ...@@ -184,6 +184,13 @@ class KubernetesReplicationControllerConf:
aux = self.conf['spec']['template'] # type: Dict aux = self.conf['spec']['template'] # type: Dict
aux['spec']['containers'][0]['resources']['limits']['cpu'] = corelimit aux['spec']['containers'][0]['resources']['limits']['cpu'] = corelimit
def set_spec_container_command(self, command):
"""Setter to set container command"""
aux = self.conf['spec']['template']
aux['spec']['containers'][0]['command'] = []
command_arr = command.split(" ")
aux['spec']['containers'][0]['command'] = command_arr
def set_spec_container_volumes(self, volumes: List[VolumeDescription], name: str): def set_spec_container_volumes(self, volumes: List[VolumeDescription], name: str):
"""Setter to set container volumes""" """Setter to set container volumes"""
aux = self.conf['spec']['template'] # type: Dict aux = self.conf['spec']['template'] # type: Dict
...@@ -261,6 +268,9 @@ class KubernetesClient: ...@@ -261,6 +268,9 @@ class KubernetesClient:
if len(service_instance.volumes) > 0: if len(service_instance.volumes) > 0:
config.set_spec_container_volumes(service_instance.volumes, service_instance.name) config.set_spec_container_volumes(service_instance.volumes, service_instance.name)
if service_instance.command is not None:
config.set_spec_container_command(service_instance.command)
info = {} info = {}
try: try:
......
...@@ -43,13 +43,13 @@ class KubernetesBackend(zoe_master.backends.base.BaseBackend): ...@@ -43,13 +43,13 @@ class KubernetesBackend(zoe_master.backends.base.BaseBackend):
"""Initializes Kubernetes backend starting the event monitoring thread.""" """Initializes Kubernetes backend starting the event monitoring thread."""
global _monitor, _checker global _monitor, _checker
_monitor = KubernetesMonitor(state) _monitor = KubernetesMonitor(state)
_checker = KubernetesStateSynchronizer(state) # _checker = KubernetesStateSynchronizer(state)
@classmethod @classmethod
def shutdown(cls): def shutdown(cls):
"""Performs a clean shutdown of the resources used by Swarm backend.""" """Performs a clean shutdown of the resources used by Swarm backend."""
_monitor.quit() _monitor.quit()
_checker.quit() # _checker.quit()
def spawn_service(self, service_instance: ServiceInstance): def spawn_service(self, service_instance: ServiceInstance):
"""Spawn a service, translating a Zoe Service into a Docker container.""" """Spawn a service, translating a Zoe Service into a Docker container."""
......
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