def _parse_graphlearn_service_endpoint(self, object_id): if self._saved_locals["service_type"] == "NodePort": services = self._core_api.list_namespaced_service( self._saved_locals["namespace"]) for svc in services.items: if svc.metadata.name == self._gle_service_name_prefix + str( object_id): endpoints = [] for ip, port_spec in zip(self._pod_host_ip_list, svc.spec.ports): endpoints.append(( "%s:%s" % (ip, port_spec.node_port), int(port_spec.name.split("-")[-1]), )) endpoints.sort(key=lambda ep: ep[1]) return [ep[0] for ep in endpoints] elif self._saved_locals["service_type"] == "LoadBalancer": endpoints = get_service_endpoints( api_client=self._api_client, namespace=self._saved_locals["namespace"], name=self._gle_service_name_prefix + str(object_id), service_type=self._saved_locals["service_type"], ) return endpoints raise RuntimeError("Get graphlearn service endpoint failed.")
def _get_etcd_service_endpoint(self): # Always len(endpoints) >= 1 endpoints = get_service_endpoints( api_client=self._api_client, namespace=self._namespace, name=self._etcd_service_name, type="ClusterIP", ) return endpoints[0]
def _get_vineyard_service_endpoint(self): # Always len(endpoints) >= 1 endpoints = get_service_endpoints( api_client=self._api_client, namespace=self._namespace, name=self._vineyard_service_name, type=self._service_type, ) return endpoints[0]
def _get_vineyard_service_endpoint(self): # Always len(endpoints) >= 1 endpoints = get_service_endpoints( api_client=self._api_client, namespace=self._saved_locals["namespace"], name=self._vineyard_service_name, service_type=self._saved_locals["service_type"], ) return endpoints[0]
def _get_mars_scheduler_service_endpoint(self): # Always len(endpoints) >= 1 endpoints = get_service_endpoints( api_client=self._api_client, namespace=self._saved_locals["namespace"], name=self._mars_service_name, service_type=self._saved_locals["service_type"], query_port=self._mars_scheduler_web_port, ) return endpoints[0]
def _get_coordinator_endpoint(self): if self._saved_locals["k8s_service_type"] is None: # try to get endpoint from configmap return self._try_to_get_coordinator_service_from_configmap() # Always len(endpoints) >= 1 endpoints = get_service_endpoints( api_client=self._api_client, namespace=self._namespace, name=self._coordinator_service_name, service_type=self._saved_locals["k8s_service_type"], ) return endpoints[0]
def _get_coordinator_endpoint(self): if is_minikube_cluster() and self._minikube_vm_driver: return self._get_minikube_service(self._namespace, self._coordinator_service_name) # Always len(endpoints) >= 1 endpoints = get_service_endpoints( api_client=self._api_client, namespace=self._namespace, name=self._coordinator_service_name, type=self._service_type, ) return endpoints[0]