Skip to content

Commit 7d17df2

Browse files
authored
[HWORKS-2145] Documentation for external access to model deployments (#470) (#472)
1 parent 586fb3b commit 7d17df2

12 files changed

+145
-2
lines changed
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

docs/setup_installation/admin/auth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Authentication Methods
22

33
## Introduction
4-
Hopsworks can be configured to use different type of authentication methods. In this guide we will look at the
4+
Hopsworks can be configured to use different types of authentication methods. In this guide we will look at the
55
different authentication methods available in Hopsworks.
66

77
## Prerequisites
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
description: Documentation on how to configure external access to a model deployment
3+
---
4+
5+
# How To Configure External Access To A Model Deployment
6+
7+
## Introduction
8+
9+
Hopsworks supports role-based access control (RBAC) for project members within a project, where a project ML assets can only be accessed by Hopsworks users that are members of that project (See [governance](../../../concepts/projects/governance.md)).
10+
11+
However, there are cases where you might want to grant ==external users== with access to specific model deployments without them having to register into Hopsworks or to join the project which will give them access to all project ML assets. For these cases, Hopsworks supports fine-grained access control to model deployments based on ==user groups== managed by an external Identity Provider.
12+
13+
!!! info "Authentication methods"
14+
Hopsworks can be configured to use different types of authentication methods including OAuth2, LDAP and Kerberos. See the [Authentication Methods Guide](../../../setup_installation/admin/auth.md) for more information.
15+
16+
## GUI (for Hopsworks users)
17+
18+
### Step 1: Navigate to a model deployment
19+
20+
If you have at least one model deployment already created, navigate to the model deployments page by clicking on the `Deployments` tab on the navigation menu on the left.
21+
22+
<p align="center">
23+
<figure>
24+
<img src="../../../../assets/images/guides/mlops/serving/deployments_tab_sidebar_with_list.svg" alt="Deployments navigation tab">
25+
<figcaption>Deployments navigation tab</figcaption>
26+
</figure>
27+
</p>
28+
29+
Once in the model deployments page, find the model deployment you want to configure external access and click on the name of the deployment to open the model deployment overview page.
30+
31+
<p align="center">
32+
<figure>
33+
<img src="../../../../assets/images/guides/mlops/serving/deployment_overview.png" alt="Deployment overview">
34+
<figcaption>Deployment overview</figcaption>
35+
</figure>
36+
</p>
37+
38+
### Step 2: Go to External Access
39+
40+
You can find the external access configuration by clicking on `External access` on the navigation menu on the left or scrolling down to the external access section.
41+
42+
<p align="center">
43+
<figure>
44+
<img src="../../../../assets/images/guides/mlops/serving/deployment_external_access.png" alt="Deployment external access">
45+
<figcaption>External access configuration</figcaption>
46+
</figure>
47+
</p>
48+
49+
### Step 3: Add or remove user groups
50+
51+
In this section, you can add and remove user groups by clicking on `edit external user groups` and typing the group name in the **text-free** input field or **selecting** one of the existing ones in the dropdown list. After that, click on the `save` button to persist the changes.
52+
53+
54+
!!! Warn "Case sensitivity"
55+
Inference requests are authorized using a ==case-sensitive exact match== between the group names of the user making the request and the group names granted access to the model deployment. Therefore, a user assigned to the group `lab1` won't have access to a model deployment accessible by group `LAB1`.
56+
57+
<p align="center">
58+
<figure>
59+
<img src="../../../../assets/images/guides/mlops/serving/deployment_external_access_edit.png" alt="Deployment external access">
60+
<figcaption>External access configuration</figcaption>
61+
</figure>
62+
</p>
63+
64+
## GUI (for external users)
65+
66+
### Step 1: Login with the external identity provider
67+
68+
Navigate to Hopsworks, and click on the `Login with` button to sign in using the configured external identity provider (e.g., Keycloak in this example).
69+
70+
<p align="center">
71+
<figure>
72+
<img style="max-width: 50%" src="../../../../assets/images/guides/mlops/serving/login_external_idp.png" alt="Login external identity provider">
73+
<figcaption>Login with External Identity Provider</figcaption>
74+
</figure>
75+
</p>
76+
77+
### Step 2: Explore the model deployments you are granted access to
78+
79+
Once you sign in to Hopsworks, you can see the list of model deployments you are granted access to based on your assigned groups.
80+
81+
<p align="center">
82+
<figure>
83+
<img src="../../../../assets/images/guides/mlops/serving/deployment_external_list.png" alt="Deployments list">
84+
<figcaption>Deployments with external access</figcaption>
85+
</figure>
86+
</p>
87+
88+
### Step 2: Inspect your current groups
89+
90+
You can find the current groups you are assigned to at the top of the page.
91+
92+
<p align="center">
93+
<figure>
94+
<img src="../../../../assets/images/guides/mlops/serving/deployment_external_groups.png" alt="External user groups">
95+
<figcaption>External user groups</figcaption>
96+
</figure>
97+
</p>
98+
99+
### Step 3: Get an API key
100+
101+
Inference requests to model deployments are authenticated and authorized based on your external user and user groups. You can create API keys to authenticate your inference requests by clicking on the `Create API Key` button.
102+
103+
!!! info "Authorization header"
104+
API keys are set in the `Authorization` header following the format `ApiKey <api-key-value>`
105+
106+
<p align="center">
107+
<figure>
108+
<img src="../../../../assets/images/guides/mlops/serving/deployment_external_api_key.png" alt="Get API key">
109+
<figcaption>Get API key</figcaption>
110+
</figure>
111+
</p>
112+
113+
### Step 4: Send inference requests
114+
115+
Depending on the type of model deployment, the URI of the model server can differ (e.g., `/chat/completions` for LLM deployments or `/predict` for traditional model deployments). You can find the corresponding URI on every model deployment card.
116+
117+
In addition to the `Authorization` header containing the API key, the `Host` header needs to be set according to the model deployment where the inference requests are sent to. This header is used by the ingress to route the inference requests to the corresponding model deployment. You can find the `Host` header value in the model deployment card.
118+
119+
!!! tip "Code snippets"
120+
For clients sending inference requests using libraries similar to curl or OpenAI API-compatible libraries (e.g., LangChain), you can find code snippet examples by clicking on the `Curl >_` and `LangChain >_` buttons.
121+
122+
<p align="center">
123+
<figure>
124+
<img src="../../../../assets/images/guides/mlops/serving/deployment_external_code_snippets.png" alt="Deployment endpoint">
125+
<figcaption>Deployment endpoint</figcaption>
126+
</figure>
127+
</p>
128+
129+
## Refreshing External User Groups
130+
131+
Every time an external user signs in to Hopsworks using a pre-configured [authentication method](../../../setup_installation/admin/auth.md), Hopsworks fetches the external user groups and updates the internal state accordingly. Given that groups can be added/removed from users at any time by the Identity Provider, Hopsworks needs to periodically fetch the external user groups to keep the state updated.
132+
133+
Therefore, external users that want to access model deployments are **required to login periodically** to ensure they are still part of the allowed groups. The timespan between logins is controlled by the configuration parameter `requireExternalUserLoginAfterHours` available during the Hopsworks installation and upgrade.
134+
135+
The `requireExternalUserLoginAfterHours` configuration parameter controls the ==number of hours== after which external users are required to sign in to Hopsworks to refresh their external user groups.
136+
137+
!!! info "Configuring `requireExternalUserLoginAfterHours`"
138+
Allowed values are -1, 0 and greater than 0, where -1 disables the periodic login requirement and 0 disables external access completely for every model deployment.

docs/user_guides/mlops/serving/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ Configure the predictor to log inference requests and predictions, see the [Infe
2626

2727
### Troubleshooting
2828

29-
Inspect the model server logs to troubleshoot your model deployments, see the [Troubleshooting Guide](troubleshooting.md).
29+
Inspect the model server logs to troubleshoot your model deployments, see the [Troubleshooting Guide](troubleshooting.md).
30+
31+
### External access
32+
33+
Grant users authenticated by an external Identity Provider access to model deployments, see the [External Access Guide](external-access.md).

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ nav:
201201
- Inference Batcher: user_guides/mlops/serving/inference-batcher.md
202202
- API Protocol: user_guides/mlops/serving/api-protocol.md
203203
- Troubleshooting: user_guides/mlops/serving/troubleshooting.md
204+
- External Access: user_guides/mlops/serving/external-access.md
204205
- Vector Database: user_guides/mlops/vector_database/index.md
205206
- Provenance: user_guides/mlops/provenance/provenance.md
206207
- Migration:

0 commit comments

Comments
 (0)