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

[Serve] Authorization on load balancer #3553

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

cblmemo
Copy link
Collaborator

@cblmemo cblmemo commented May 15, 2024

Adding an authorization on load balancer.

To discuss: Can this be used in the same time of #3552 ? If so, does that means the api-key on the LB and the replica should algin?

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
$ sky serve up examples/serve/auth-server.yaml -n auth
Service from YAML spec: examples/serve/auth-server.yaml
Service Spec:
Readiness probe method:           GET /
Readiness initial delay seconds:  1200
Replica autoscaling policy:       Fixed 1 replica
Spot Policy:                      No spot policy
Authorization:                    Bearer sky-authkey-3d2105b9-a9ba-4f13
$ curl $(sky serve status --endpoint auth) -H 'Authorization: Bearer sky-authkey-3d2105b9-a9ba-4f13'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Directory listing for /?</title>
</head>
<body>
<h1>Directory listing for /?</h1>
<hr>
<ul>
</ul>
<hr>
</body>
</html>
$ curl $(sky serve status --endpoint auth) -H 'Authorization: Bearer wrong-token' 
{"error":"Unauthorized"}
  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
  • Backward compatibility tests: conda deactivate; bash -i tests/backward_compatibility_tests.sh

@cblmemo cblmemo marked this pull request as draft May 15, 2024 07:03
@cblmemo cblmemo marked this pull request as ready for review May 15, 2024 10:10
@@ -0,0 +1,10 @@
service:
readiness_probe: /
auth_key: sky-authkey-3d2105b9-a9ba-4f13
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it take an env instead to be safer?

Also, should we instead allow the readiness_probe to specify a header as well, so the user can specify the authentication in the header directly, instead of adding a new field auth_key?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ability to add headers is implemented in #3552, but that is for the authorization for replica endpoint. Do you mean we should infer the authorization for LB from replica directly?
(We could discuss more in our next meeting

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, this PR is for adding authorization for the load balancer along. We should check if this is necessary with users. : )

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG! Lets defer it

@cblmemo cblmemo marked this pull request as draft May 22, 2024 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants