Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions python/portforward/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,17 @@ def _config_path(config_path_arg) -> str:
elif config_path_arg:
return config_path_arg

# If KUBECONFIG is set, it might be a ":" separated list of paths
config_path = os.environ.get("KUBECONFIG", "")
if config_path:
for path in config_path.split(os.pathsep):
path = path.strip()
if path and os.path.isfile(path):
return path

# Fallback to the alternate path
alt_path = str(Path.home() / ".kube" / "config")

config_path = os.environ.get("KUBECONFIG", alt_path)

return config_path if os.path.isfile(config_path) else ""
return alt_path if os.path.isfile(alt_path) else ""


def _kube_context(context):
Expand Down
Loading