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

Narrow down RBAC rules #2091

Merged
merged 21 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions examples/v1beta1/argo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,18 @@ with the appropriate permission:
resources:
- workflows
verbs:
- "*"
- "get"
- "list"
- "watch"
- "create"
- "delete"
```

Run the following command to update Katib ClusterRole:

```bash
kubectl patch ClusterRole katib-controller -n kubeflow --type=json \
-p='[{"op": "add", "path": "/rules/-", "value": {"apiGroups":["argoproj.io"],"resources":["workflows"],"verbs":["*"]}}]'
-p='[{"op": "add", "path": "/rules/-", "value": {"apiGroups":["argoproj.io"],"resources":["workflows"],"verbs":["get", "list", "watch", "create", "delete"]}}]'
```

In addition to that, you have to modify Katib
Expand Down
8 changes: 6 additions & 2 deletions examples/v1beta1/tekton/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,18 @@ with the appropriate permission:
- pipelineruns
- taskruns
verbs:
- "*"
- "get"
- "list"
- "watch"
- "create"
- "delete"
```

Run the following command to update Katib ClusterRole:

```bash
kubectl patch ClusterRole katib-controller -n kubeflow --type=json \
-p='[{"op": "add", "path": "/rules/-", "value": {"apiGroups":["tekton.dev"],"resources":["pipelineruns", "taskruns"],"verbs":["*"]}}]'
-p='[{"op": "add", "path": "/rules/-", "value": {"apiGroups":["tekton.dev"],"resources":["pipelineruns", "taskruns"],"verbs":["get", "list", "watch", "create", "delete"]}}]'
```

In addition to that, you have to modify Katib
Expand Down
77 changes: 63 additions & 14 deletions manifests/v1beta1/components/controller/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,93 @@ rules:
- apiGroups:
- ""
resources:
- configmaps
- serviceaccounts
- services
verbs:
- "get"
- "list"
- "watch"
- "create"
- "delete"
- apiGroups:
- ""
resources:
- events
- namespaces
verbs:
- "create"
- "patch"
- "update"
- apiGroups:
- ""
resources:
- serviceaccounts
- persistentvolumes
- persistentvolumeclaims
verbs:
- "get"
- "list"
- "watch"
- "create"
- apiGroups:
- ""
resources:
- namespaces
Copy link
Member

Choose a reason for hiding this comment

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

Do we need permission for namespace in the Controller @johnugeorge @tenzen-y ?

Copy link
Member

Choose a reason for hiding this comment

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

As I can see, we operate namespaces only from UI. So we can remove the permission for namespaces.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. It is needed only in UI.

Copy link
Member Author

Choose a reason for hiding this comment

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

I retested it. Currently, Katib needs get/list/watch for namespaces as well. Need to investigate separately

- configmaps
verbs:
- "get"
- "list"
- "watch"
- apiGroups:
- ""
resources:
- pods
- pods/log
- pods/status
- secrets
verbs:
- "*"
- "get"
- apiGroups:
- apps
resources:
- deployments
verbs:
- "*"
- "get"
- "list"
- "watch"
- "create"
- "delete"
- apiGroups:
- rbac.authorization.k8s.io
resources:
- roles
- rolebindings
verbs:
- "*"
- "get"
- "create"
- "list"
- "watch"
- apiGroups:
- batch
resources:
Copy link
Member

Choose a reason for hiding this comment

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

@johnugeorge Should we limit scope for deployment, batch, and kubeflow.org jobs ?

Copy link
Member Author

Choose a reason for hiding this comment

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

we do get/create/delete/watch for all

- jobs
- cronjobs
verbs:
- "*"
- "get"
- "list"
- "watch"
- "create"
- "delete"
- apiGroups:
- kubeflow.org
resources:
- tfjobs
- pytorchjobs
- mpijobs
- xgboostjobs
- mxjobs
verbs:
- "get"
- "list"
- "watch"
- "create"
- "delete"
- apiGroups:
- kubeflow.org
resources:
Expand All @@ -52,11 +106,6 @@ rules:
- suggestions
- suggestions/status
- suggestions/finalizers
- tfjobs
- pytorchjobs
- mpijobs
- xgboostjobs
- mxjobs
verbs:
- "*"
---
Expand Down