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

Narrow down RBAC rules #2091

merged 21 commits into from
Jan 25, 2023

Conversation

johnugeorge
Copy link
Member

@johnugeorge johnugeorge commented Jan 20, 2023

This PR narrows down the RBAC rules for Katib controller installation

Fixes: #1639

@johnugeorge
Copy link
Member Author

/hold for review

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: johnugeorge

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

@johnugeorge Thanks for this!
I confirmed this RBAC on my local using the following operation:

  • create and delete random.yaml by kubectl and UI.
  • create and delete from-volume-resume.yaml by kubectl and UI.

That works well.

Also, maybe we want to generate RBAC manifests by sigs.k8s.io/controller-tools/cmd/controller-gen in the future.

Note: Currently, cert-generator requires full access to secrets and UI needs full access to configmaps. Can we reduce it in the future?

I guess the cert-generator has limited access to secrets, now.

verbs:
- get
- create
- delete

/lgtm

@google-oss-prow google-oss-prow bot removed the lgtm label Jan 20, 2023
@johnugeorge
Copy link
Member Author

@johnugeorge Thanks for this! I confirmed this RBAC on my local using the following operation:

  • create and delete random.yaml by kubectl and UI.
  • create and delete from-volume-resume.yaml by kubectl and UI.

That works well.

Also, maybe we want to generate RBAC manifests by sigs.k8s.io/controller-tools/cmd/controller-gen in the future.

Note: Currently, cert-generator requires full access to secrets and UI needs full access to configmaps. Can we reduce it in the future?

I guess the cert-generator has limited access to secrets, now.

verbs:
- get
- create
- delete

/lgtm

Fixed configmaps and secrets as well

@johnugeorge
Copy link
Member Author

/assign @andreyvelich @tenzen-y

@tenzen-y
Copy link
Member

I have confirmed new changes using the same way as #2091 (review), again.

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Jan 20, 2023
@andreyvelich
Copy link
Member

Thank you for this @johnugeorge!
I will check it on Monday.

- services
- events
- namespaces
verbs:
- "*"
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 * for services ?

Copy link
Member Author

Choose a reason for hiding this comment

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

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

- 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

- "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

@google-oss-prow google-oss-prow bot removed the lgtm label Jan 23, 2023
@andreyvelich
Copy link
Member

/lgtm

@google-oss-prow google-oss-prow bot removed the lgtm label Jan 25, 2023
Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

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

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Jan 25, 2023
@johnugeorge
Copy link
Member Author

/hold cancel

@tenzen-y
Copy link
Member

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Narrow and explicit RBAC
3 participants