Skip to content

feat: make console, proxy, and endpoint hosts configurable - #684

Merged
deanq merged 3 commits into
mainfrom
deanq/sls-970-host-overrides
Nov 6, 2026
Merged

deanq merged 3 commits into
mainfrom
deanq/sls-970-host-overrides

Conversation

@deanq

@deanq deanq commented Nov 5, 2026

Copy link
Copy Markdown
Member

Summary

Some URLs were built from hardcoded hosts and so ignored the existing host overrides:

Where Was Now
rp console links (rp_cli/console.py) console.runpod.io RUNPOD_CONSOLE_URL
Login URL (apps/auth.py) RUNPOD_CONSOLE_URL, read once at import RUNPOD_CONSOLE_URL, read on each call
Task calls (apps/tasks.py) <pod>-8080.proxy.runpod.net RUNPOD_PROXY_DOMAIN (new)
rp pod get URLs (rp_cli/pod.py) proxy.runpod.net RUNPOD_PROXY_DOMAIN
rp endpoint run load-balancer fallback (rp_cli/endpoint.py) <id>.api.runpod.ai host of RUNPOD_ENDPOINT_BASE_URL

All of these now go through a small runpod/_hosts.py module: console_url(), proxy_url() and endpoint_domain(). It reads the env vars on each call, so a value set after import runpod still takes effect. Blank values fall back to the defaults. apps/targets._lb_domain now uses the same helper.

With none of these env vars set, every URL is the same as before.

Test plan

  • New tests/test_hosts.py: defaults, overrides, and blank values falling back to the default
  • One test per call site that sets the override and checks the resulting URL. Each failed before the change.
  • make quality-check: 2746 passed, 94.29% coverage; runpod/_hosts.py at 100%

Console links, pod proxy URLs, and load-balancer fallback URLs were
built from hardcoded hosts, so they ignored the existing
RUNPOD_CONSOLE_URL and RUNPOD_ENDPOINT_BASE_URL overrides.

- Add runpod/_hosts.py: console_url(), proxy_url(), endpoint_domain()
- RUNPOD_CONSOLE_URL now applies to rp console links, and is read at
  call time for the login URL instead of at import
- New RUNPOD_PROXY_DOMAIN (default proxy.runpod.net) for task calls
  and rp pod URLs
- rp endpoint run derives the load-balancer host from
  RUNPOD_ENDPOINT_BASE_URL when the API omits requestUrls.base

Defaults are unchanged.
Comment thread tests/test_cli/test_pod_command.py Fixed
Comment thread tests/test_hosts.py Fixed
- Compare the exact proxy URL list instead of a substring check.
- Patch runpod.endpoint_url_base by string target so the tests no
  longer import runpod both ways.
@deanq
deanq requested review from a team and KAJdev and a balanced review from Copilot November 6, 2026 00:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Endpoint URL resolution uses a stale host when the environment variable changes after import and produces malformed URLs when its initial value is blank.

1 open issue
What changed in this PR

This PR centralizes service-host resolution so CLI links, login URLs, task requests, and endpoint fallbacks can use configurable hosts rather than hardcoded public domains.

Changes:

  • Adds shared helpers for console URLs, proxy URLs, and endpoint domains.
  • Updates CLI and app call sites to use those helpers.
  • Adds helper and call-site tests for host overrides and default behavior.
File Description
tests/​test_hosts.py Tests host helpers, defaults, and overrides.
tests/​test_cli/​test_pod_command.py Tests proxy overrides in pod URLs.
tests/​test_cli/​test_endpoint_command.py Tests the configured load-balancer fallback domain.
tests/​test_cli/​test_console.py Tests console-link overrides.
tests/​test_apps/​test_tasks.py Tests task proxy-domain overrides.
tests/​test_apps/​test_auth.py Tests call-time console overrides for login.
runpod/​rp_cli/​pod.py Uses the shared proxy URL helper.
runpod/​rp_cli/​endpoint.py Derives the load-balancer fallback domain.
runpod/​rp_cli/​console.py Builds endpoint links from the console helper.
runpod/​apps/​tasks.py Uses configurable task proxy URLs.
runpod/​apps/​targets.py Delegates endpoint-domain resolution to the shared helper.
runpod/​apps/​auth.py Resolves the console URL when generating login links.
runpod/​_hosts.py Introduces shared service-host helpers.

Review effort: Balanced

Comment thread runpod/_hosts.py Resolved

@briandconnelly briandconnelly left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes recommended before merge.

Endpoint host resolution should be fixed because it does not provide the advertised call-time overrides or blank-value defaults. Tests were read, not run.

⚠️ Worth fixing

What changed

The pull request centralizes console, pod proxy, and endpoint domain resolution in runpod/_hosts.py and updates SDK and CLI call sites to use it. It adds helper and call-site tests for host overrides.

👾 Reviewed by review-agent (GPT-6.1 Sol) on behalf of briandconnelly

Commit 94ebfe0 · 1 inline comment

Comment thread runpod/_hosts.py Resolved
endpoint_domain() read runpod.endpoint_url_base, which is set once at
import. Setting RUNPOD_ENDPOINT_BASE_URL after import had no effect,
and a blank value at import produced an empty domain.

Read RUNPOD_ENDPOINT_BASE_URL on each call (stripped, blank treated as
unset), then fall back to a non-blank runpod.endpoint_url_base for
programmatic configuration, then to the public default.
marie-karpinska
marie-karpinska approved these changes Nov 6, 2026 •
@deanq
deanq merged commit b9583f7 into main Nov 6, 2026
9 checks passed
@deanq
deanq deleted the deanq/sls-970-host-overrides branch November 6, 2026 19:41

@KAJdev KAJdev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have a document or notion doc or something internal with a snippet to easily switch between dev and prod hosts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants