-
Notifications
You must be signed in to change notification settings - Fork 921
[Jobs] Authenticate requests from loopback address when consolidation mode is enabled #7396
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
Conversation
|
/smoke-test -k test_loopback_access_with_basic_auth |
|
/smoke-test -k test_loopback_access_with_basic_auth |
|
/smoke-test -k test_loopback_access_with_basic_auth |
|
/smoke-test -k test_loopback_access_with_basic_auth |
|
/quicktest-core --base-branch master |
|
/smoke-test |
|
/smoke-test --remote-server |
|
/smoke-test --remote-server --kubernetes |
| smoke_tests_utils.run_one_test(test) | ||
|
|
||
|
|
||
| @pytest.mark.no_remote_server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipping as this test requires restarting the API server.
|
/smoke-test --remote-server |
|
/quicktest-core --base-branch v0.10.1 |
Fixes #7159.
The new managed jobs controller code uses the local API server in consolidation mode, but if you are using SSO or basic auth, it somehow needs to authenticate, even though it's running on the same host, just in different processes.
This PR fixes this by bypassing the oauth2 and basic auth middleware, if consolidation mode is enabled AND the request comes from a loopback address. We also handle the case where there is a proxy running in the same host (in which case the request will come from a loopback address), by checking for common headers added by proxies such as X-Forwarded-For, Forwarded, etc.
We also considered having the API server open a Unix domain socket, and similarly have requests to the socket be treated as internal (no auth needed), however it doesn't seem like there is a good way to do this in uvicorn while being able to share worker processes with the existing server.
Tested (run the relevant ones):
bash format.shtest_loopback_access_with_basic_authSKYPILOT_AUTH_OAUTH2_PROXY_ENABLED=true/smoke-test(CI) orpytest tests/test_smoke.py(local)/smoke-test -k test_name(CI) orpytest tests/test_smoke.py::test_name(local)/quicktest-core(CI) orpytest tests/smoke_tests/test_backward_compat.py(local)