Implementation:Kubeflow Pipelines Get Proxy URL
| Knowledge Sources | |
|---|---|
| Domains | GCP, Networking |
| Last Updated | 2026-02-13 14:00 GMT |
Overview
CLI tool that determines the correct inverting proxy URL for a given GCP zone using geographic proximity-based selection.
Description
The get_proxy_url.py module (117 lines) implements a zone-to-proxy URL resolver. The `urls_for_zone()` function builds a prioritized list of candidate URLs by: (1) exact region match, (2) approximate region match (prefix), and (3) country-level fallback. The `main()` function reads a JSON config file, resolves candidates for the given zone, and sends HTTP HEAD requests to find the first accessible proxy (indicated by HTTP 307 status).
Usage
Run as a CLI tool by `attempt-register-vm-on-proxy.sh` to select the nearest available inverting proxy server for KFP UI access.
Code Reference
Source Location
- Repository: Kubeflow_Pipelines
- File: proxy/get_proxy_url.py
- Lines: 1-117
Signature
def urls_for_zone(zone: str, location_to_urls: dict) -> list:
"""Returns prioritized proxy URLs for a GCP zone.
Priority: exact region > approximate region > country fallback."""
def main() -> None:
"""CLI entry point. Parses args, reads config, probes URLs,
prints first accessible proxy URL to stdout."""
Import
from get_proxy_url import urls_for_zone
# Or run as CLI:
# python get_proxy_url.py --config-file-path config.json --location us-west1-b --version v1
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| --config-file-path | CLI arg | Yes | JSON file with proxy URL mappings by version and region |
| --location | CLI arg | Yes | GCP zone string (e.g., us-west1-b) |
| --version | CLI arg | Yes | Proxy version key in config |
Outputs
| Name | Type | Description |
|---|---|---|
| stdout | string | Selected proxy URL (first URL returning HTTP 307) |
Usage Examples
Running the Proxy URL Resolver
python proxy/get_proxy_url.py \
--config-file-path proxy/proxy-config.json \
--location us-central1-a \
--version v1
# Output: https://proxy.us-central1.example.com