def __init__(self): self.inside_cluster = os.getenv(ENV_K8S_SERVICE_HOST) try: if self.inside_cluster: logger.debug("Loading cluster local config") config.load_incluster_config() else: logger.debug("Loading external kubernetes config") config.load_kube_config() except Exception: logger.warning( "Failed to load kubeconfig. Only local mode is possible.")
def __init__(self, model_details: ModelDetails, namespace, protocol: Protocol, gateway=ISTIO_GATEWAY): self.inside_cluster = os.getenv(ENV_K8S_SERVICE_HOST) try: if self.inside_cluster: logger.debug("Loading cluster local config") config.load_incluster_config() else: logger.debug("Loading external kubernetes config") config.load_kube_config() except: logger.warning( "Failed to load kubeconfig. Only local mode is possible.") self.gateway = gateway self.model_details = model_details self.namespace = namespace self.protocol = protocol