Skip to content

Commit 4541f35

Browse files
committed
addressed the review comments
Signed-off-by: Abdul Hameed <ahameed@redhat.com>
1 parent b5d81f1 commit 4541f35

File tree

3 files changed

+45
-26
lines changed

3 files changed

+45
-26
lines changed

examples/operator-rbac/1-setup-operator-rbac.ipynb

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
"* `Online Store Server`: Uses the `Registry Server` to query metadata and is responsible for low-latency serving of features.\n",
2929
"* `Offline Store Server`: Uses the `Registry Server` to query metadata and provides access to batch data for historical feature retrieval.\n",
3030
"* `Kubernetes` Authentication types for RBAC Configuration for Feast resources.\n",
31-
"* Setting update Feast RBAC based on roles assigned then validating with client example.\n"
31+
"\n",
32+
"\n",
33+
"Additionally, we will cover:\n",
34+
"* RBAC Configuration with Kubernetes Authentication for Feast resources."
3235
]
3336
},
3437
{
@@ -298,14 +301,14 @@
298301
"cell_type": "markdown",
299302
"source": [
300303
"## Configure the RBAC Permissions\n",
301-
"we have defined permission in `permissions_apply.py`."
304+
" As we have created Kubernetes roles in **FeatureStore CR** to manage access control feast objects, they python script permissions_apply.py will add into feature_repo and applied to registered the permission in registry. \n"
302305
]
303306
},
304307
{
305308
"metadata": {
306309
"ExecuteTime": {
307-
"end_time": "2025-03-05T18:49:43.015317Z",
308-
"start_time": "2025-03-05T18:49:42.826986Z"
310+
"end_time": "2025-03-06T14:04:10.725890Z",
311+
"start_time": "2025-03-06T14:04:10.571089Z"
309312
}
310313
},
311314
"cell_type": "code",
@@ -318,31 +321,37 @@
318321
"name": "stdout",
319322
"output_type": "stream",
320323
"text": [
324+
"# Necessary modules for permissions and policies in Feast for RBAC\r\n",
321325
"from feast.feast_object import ALL_RESOURCE_TYPES\r\n",
322326
"from feast.permissions.action import READ, AuthzedAction, ALL_ACTIONS\r\n",
323327
"from feast.permissions.permission import Permission\r\n",
324328
"from feast.permissions.policy import RoleBasedPolicy\r\n",
325329
"\r\n",
326-
"admin_roles = [\"feast-writer\"]\r\n",
327-
"user_roles = [\"feast-reader\"]\r\n",
330+
"# Define roles\r\n",
331+
"admin_roles = [\"feast-writer\"] # Full access (can create, update, delete ) Feast Resources\r\n",
332+
"user_roles = [\"feast-reader\"] # Read-only access on Feast Resources\r\n",
328333
"\r\n",
334+
"# User permissions (feast_user_permission)\r\n",
335+
"# - Grants read and describing Feast objects access\r\n",
329336
"user_perm = Permission(\r\n",
330337
" name=\"feast_user_permission\",\r\n",
331338
" types=ALL_RESOURCE_TYPES,\r\n",
332339
" policy=RoleBasedPolicy(roles=user_roles),\r\n",
333-
" actions=[AuthzedAction.DESCRIBE] + READ\r\n",
340+
" actions=[AuthzedAction.DESCRIBE] + READ # Read access (READ_ONLINE, READ_OFFLINE) + describe other Feast Resources.\r\n",
334341
")\r\n",
335342
"\r\n",
343+
"# Admin permissions (feast_admin_permission)\r\n",
344+
"# - Grants full control over all resources\r\n",
336345
"admin_perm = Permission(\r\n",
337346
" name=\"feast_admin_permission\",\r\n",
338347
" types=ALL_RESOURCE_TYPES,\r\n",
339348
" policy=RoleBasedPolicy(roles=admin_roles),\r\n",
340-
" actions=ALL_ACTIONS\r\n",
349+
" actions=ALL_ACTIONS # Full permissions: CREATE, UPDATE, DELETE, READ, WRITE\r\n",
341350
")\r\n"
342351
]
343352
}
344353
],
345-
"execution_count": 159
354+
"execution_count": 167
346355
},
347356
{
348357
"metadata": {
@@ -726,7 +735,7 @@
726735
{
727736
"metadata": {},
728737
"cell_type": "markdown",
729-
"source": "## Next Run Client notebook -> 2-client.ipynb"
738+
"source": "[Next Run Client notebook](./2-client.ipynb)"
730739
}
731740
],
732741
"metadata": {

examples/operator-rbac/2-client.ipynb

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55
"cell_type": "markdown",
66
"source": [
77
"## Feast Client with RBAC\n",
8-
"### RBAC Kubernetes Authentication\n",
9-
"Feast **Role-Based Access Control (RBAC)** in Kubernetes supports authentication **inside a Kubernetes pod** and **outside a pod** when running a local script.\n",
8+
"### Kubernetes RBAC Authorization\n",
9+
"\n",
10+
"## Feast Role-Based Access Control (RBAC) in Kubernetes \n",
11+
"\n",
12+
"Feast **Role-Based Access Control (RBAC)** in Kubernetes supports authentication both **inside a Kubernetes pod** and for **external clients** using the `LOCAL_K8S_TOKEN` environment variable. \n",
13+
"\n",
14+
"\n",
1015
"### Inside a Kubernetes Pod\n",
1116
"Feast automatically retrieves the Kubernetes ServiceAccount token from:\n",
1217
"```\n",
@@ -18,17 +23,16 @@
1823
"- Developer just need create the binding with role and service account accordingly.\n",
1924
"- Code Reference: \n",
2025
"[Feast Kubernetes Auth Client Manager (Pod Token Usage)](https://github.com/feast-dev/feast/blob/master/sdk/python/feast/permissions/client/kubernetes_auth_client_manager.py#L15) \n",
21-
"- See the example will use service account from pod [Example](https://github.com/feast-dev/feast/blob/master/examples/rbac-remote/client/k8s/)\n",
26+
"- Using a service account from a pod [Example](https://github.com/feast-dev/feast/blob/master/examples/rbac-remote/client/k8s/)\n",
2227
"\n",
23-
"### Outside a Kubernetes Pod (Local Machine)\n",
24-
"If running Feast outside of Kubernetes, authentication requires setting the token manually:\n",
28+
"### Outside a Kubernetes Pod (External Clients & Local Testing)\n",
29+
" \n",
30+
"If running Feast outside of Kubernetes, authentication requires setting the token manually to the environment variable `LOCAL_K8S_TOKEN` :\n",
2531
"```sh\n",
2632
"export LOCAL_K8S_TOKEN=\"your-service-account-token\"\n",
2733
"```\n",
28-
"Feast will use this token for authentication.\n",
2934
"\n",
30-
"Reference: \n",
31-
"[Feast Authentication via `LOCAL_K8S_TOKEN`](https://github.com/feast-dev/feast/blob/master/sdk/python/feast/permissions/client/kubernetes_auth_client_manager.py#L50)"
35+
"For more details, refer the user guide: [Kubernetes RBAC Authorization](https://docs.feast.dev/master/getting-started/components/authz_manager#kubernetes-rbac-authorization) \n"
3236
],
3337
"id": "bb0145c9c1f6ebcc"
3438
},
@@ -89,7 +93,7 @@
8993
{
9094
"metadata": {},
9195
"cell_type": "markdown",
92-
"source": "**The Operator creates the client ConfigMap containing the feature_store.yaml. We can retrieve it and port froward to local**",
96+
"source": "**The Operator client feature store ConfigMap** containing the feature_store.yaml settings. We can retrieve it and port froward to local as we are testing locally.",
9397
"id": "84f73e09711bff9f"
9498
},
9599
{
@@ -224,8 +228,8 @@
224228
"metadata": {},
225229
"cell_type": "markdown",
226230
"source": [
227-
"**Generating training data. The following test functions were copied from the `test_workflow.py` template but we added `try` blocks to print only \n",
228-
"the relevant error messages, since we expect to receive errors from the permission enforcement modules.**"
231+
"**Generating training data**. The following test functions were copied from the `test_workflow.py` template but we added `try` blocks to print only \n",
232+
"the relevant error messages, since we expect to receive errors from the permission enforcement modules."
229233
],
230234
"id": "8c9e27ec4ed8ca2c"
231235
},
@@ -890,7 +894,7 @@
890894
{
891895
"metadata": {},
892896
"cell_type": "markdown",
893-
"source": "Next : Uninstall the Operator and all Feast objects -> 03-uninstall.ipynb",
897+
"source": "[Next: Uninstall the Operator and all Feast objects](./03-uninstall.ipynb)",
894898
"id": "38c54e92643e0bda"
895899
}
896900
],
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
1+
# Necessary modules for permissions and policies in Feast for RBAC
12
from feast.feast_object import ALL_RESOURCE_TYPES
23
from feast.permissions.action import READ, AuthzedAction, ALL_ACTIONS
34
from feast.permissions.permission import Permission
45
from feast.permissions.policy import RoleBasedPolicy
56

6-
admin_roles = ["feast-writer"]
7-
user_roles = ["feast-reader"]
7+
# Define K8s roles same as created with FeatureStore CR
8+
admin_roles = ["feast-writer"] # Full access (can create, update, delete ) Feast Resources
9+
user_roles = ["feast-reader"] # Read-only access on Feast Resources
810

11+
# User permissions (feast_user_permission)
12+
# - Grants read and describing Feast objects access
913
user_perm = Permission(
1014
name="feast_user_permission",
1115
types=ALL_RESOURCE_TYPES,
1216
policy=RoleBasedPolicy(roles=user_roles),
13-
actions=[AuthzedAction.DESCRIBE] + READ
17+
actions=[AuthzedAction.DESCRIBE] + READ # Read access (READ_ONLINE, READ_OFFLINE) + describe other Feast Resources.
1418
)
1519

20+
# Admin permissions (feast_admin_permission)
21+
# - Grants full control over all resources
1622
admin_perm = Permission(
1723
name="feast_admin_permission",
1824
types=ALL_RESOURCE_TYPES,
1925
policy=RoleBasedPolicy(roles=admin_roles),
20-
actions=ALL_ACTIONS
26+
actions=ALL_ACTIONS # Full permissions: CREATE, UPDATE, DELETE, READ, WRITE
2127
)

0 commit comments

Comments
 (0)