Skip to content

Commit

Permalink
Fix port rewrite in the case of sandbox/demo cluster (#1064)
Browse files Browse the repository at this point in the history
* Fix port rewrite in the case of sandbox/demo cluster

Signed-off-by: Eduardo Apolinario <[email protected]>

* Include endpoint in sandbox config

Signed-off-by: Eduardo Apolinario <[email protected]>

Co-authored-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
eapolinario and eapolinario authored Jun 15, 2022
1 parent 14b3a4c commit 2b4b15a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flytekit/configuration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def for_sandbox(cls) -> Config:
:return: Config
"""
return Config(
platform=PlatformConfig(insecure=True),
platform=PlatformConfig(endpoint="localhost:30081", auth_mode="Pkce", insecure=True),
data_config=DataConfig(
s3=S3Config(endpoint="http://localhost:30084", access_key_id="minio", secret_access_key="miniostorage")
),
Expand Down
18 changes: 18 additions & 0 deletions tests/flytekit/unit/remote/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,21 @@ def test_more_stuff(mock_client):
# should give a different thing
computed_v3 = r._version_from_hash(b"", serialization_settings, "hi")
assert computed_v2 != computed_v3


@patch("flytekit.remote.remote.SynchronousFlyteClient")
def test_generate_http_domain_sandbox_rewrite(mock_client):
_, temp_filename = tempfile.mkstemp(suffix=".yaml")
with open(temp_filename, "w") as f:
# This string is similar to the relevant configuration emitted by flytectl in the cases of both demo and sandbox.
flytectl_config_file = """admin:
endpoint: localhost:30081
authType: Pkce
insecure: true
"""
f.write(flytectl_config_file)

remote = FlyteRemote(
config=Config.auto(config_file=temp_filename), default_project="project", default_domain="domain"
)
assert remote.generate_http_domain() == "http://localhost:30080"

0 comments on commit 2b4b15a

Please sign in to comment.