def _get_kube_config(in_cluster: bool, cluster_context: Optional[str], config_file: Optional[str]) -> Optional[Configuration]: if in_cluster: # load_incluster_config set default configuration with config populated by k8s config.load_incluster_config() return None else: # this block can be replaced with just config.load_kube_config once # refresh_config module is replaced with upstream fix cfg = RefreshConfiguration() load_kube_config( client_configuration=cfg, config_file=config_file, context=cluster_context) return cfg
def _get_kube_config( in_cluster, # type: bool cluster_context, # type: Optional[str] config_file, # type: Optional[str] ): # type: (...) -> Optional[Configuration] if in_cluster: # load_incluster_config set default configuration with config populated by k8s config.load_incluster_config() cfg = None else: # this block can be replaced with just config.load_kube_config once # refresh_config module is replaced with upstream fix cfg = RefreshConfiguration() load_kube_config(client_configuration=cfg, config_file=config_file, context=cluster_context) if PY2: # For connect_get_namespaced_pod_exec configuration = Configuration() configuration.assert_hostname = False Configuration.set_default(configuration) return cfg