Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private Link URL support #2493

Merged
merged 3 commits into from
Jan 19, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,20 @@ def __init__(self, service):
else:
instance_name = self.nbvm["instance"]
domain_suffix = self.nbvm["domainsuffix"]
if service.is_private_link:
url_format = f"{instance_name}.{domain_suffix}\
:{service.port}"
else:
url_format = f"{instance_name}-{service.port}\
.{domain_suffix}"
self.base_url = \
f"https://{instance_name}-{service.port}.{domain_suffix}"
f"https://{url_format}"
self.successfully_detected = True
self.nbvm_origins = [
f"https://{instance_name}.{domain_suffix}",
f"https://{instance_name}-{service.port}.{domain_suffix}",
f"https://{url_format}",
f"wss://{instance_name}.{domain_suffix}",
f"wss://{instance_name}-{service.port}.{domain_suffix}",
f"wss://{url_format}",
"https://ml.azure.com",
"https://dev.ml.azure.com",
"https://int.ml.azure.com"
Expand Down
4 changes: 3 additions & 1 deletion rai_core_flask/rai_core_flask/flask_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
class FlaskHelper(object):
"""FlaskHelper is a class for common Flask utilities used in dashboards."""

def __init__(self, ip=None, port=None, with_credentials=False):
def __init__(self, ip=None, port=None, with_credentials=False,
is_private_link=False):
# The name passed to Flask needs to be unique per instance.
self.app = Flask(uuid.uuid4().hex)

self.port = port
self.ip = ip
self.with_credentials = with_credentials
self.is_private_link = is_private_link
# dictionary to store arbitrary state for use by consuming classes
self.shared_state = {}
if self.ip is None:
Expand Down
Loading