-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to Auth configurations (#68)
I realized while testing things a bit more locally that just having one endpoint was insufficient - flyte-cli and pyflyte currently leverage the gRPC Python Flyte Admin client. However, discovery needs the HTTP endpoint. Even though in production both are served on the same endpoint and traffic is handled through ingress, this is not always the case, and we want to support the use-case where gRPC Admin and HTTP Admin are hosted separately. We were debating just adding a separate config for discovery alone, but ultimately it makes more sense to split out the existing URL config into two objects, especially if the above pattern is something we want to continue to support. However, in the interest of not making people migrate, and not writing migration code in this PR, we're just introducing the HTTP one for now. Also, we should lowercase the metadata header before sending it to Admin in the gRPC calls.
- Loading branch information
1 parent
fefc659
commit 5002cae
Showing
5 changed files
with
79 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from __future__ import absolute_import | ||
import flytekit.plugins | ||
|
||
__version__ = '0.4.1' | ||
__version__ = '0.4.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from __future__ import absolute_import | ||
|
||
from flytekit.clis.auth import credentials as _credentials | ||
|
||
|
||
def test_get_discovery_endpoint(): | ||
endpoint = _credentials._get_discovery_endpoint('//localhost:8088', 'localhost:8089', True) | ||
assert endpoint == 'http://localhost:8088/.well-known/oauth-authorization-server' | ||
|
||
endpoint = _credentials._get_discovery_endpoint('//localhost:8088', 'localhost:8089', False) | ||
assert endpoint == 'https://localhost:8088/.well-known/oauth-authorization-server' | ||
|
||
endpoint = _credentials._get_discovery_endpoint('//localhost:8088/path', 'localhost:8089', True) | ||
assert endpoint == 'http://localhost:8088/path/.well-known/oauth-authorization-server' | ||
|
||
endpoint = _credentials._get_discovery_endpoint('//localhost:8088/path', 'localhost:8089', False) | ||
assert endpoint == 'https://localhost:8088/path/.well-known/oauth-authorization-server' | ||
|
||
endpoint = _credentials._get_discovery_endpoint('//flyte.corp.com', 'localhost:8089', False) | ||
assert endpoint == 'https://flyte.corp.com/.well-known/oauth-authorization-server' | ||
|
||
endpoint = _credentials._get_discovery_endpoint('//flyte.corp.com/path', 'localhost:8089', False) | ||
assert endpoint == 'https://flyte.corp.com/path/.well-known/oauth-authorization-server' | ||
|
||
endpoint = _credentials._get_discovery_endpoint(None, 'localhost:8089', True) | ||
assert endpoint == 'http://localhost:8089/.well-known/oauth-authorization-server' | ||
|
||
endpoint = _credentials._get_discovery_endpoint(None, 'localhost:8089', False) | ||
assert endpoint == 'https://localhost:8089/.well-known/oauth-authorization-server' | ||
|
||
endpoint = _credentials._get_discovery_endpoint(None, 'flyte.corp.com', True) | ||
assert endpoint == 'http://flyte.corp.com/.well-known/oauth-authorization-server' | ||
|
||
endpoint = _credentials._get_discovery_endpoint(None, 'flyte.corp.com', False) | ||
assert endpoint == 'https://flyte.corp.com/.well-known/oauth-authorization-server' | ||
|
||
endpoint = _credentials._get_discovery_endpoint(None, 'localhost:8089', True) | ||
assert endpoint == 'http://localhost:8089/.well-known/oauth-authorization-server' | ||
|
||
endpoint = _credentials._get_discovery_endpoint(None, 'localhost:8089', False) | ||
assert endpoint == 'https://localhost:8089/.well-known/oauth-authorization-server' |