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

Support custom rules for read-only mode #7152

Merged
merged 3 commits into from
Aug 16, 2022

Conversation

korjek
Copy link
Contributor

@korjek korjek commented Jun 3, 2022

When dashboard is started with read-only role, CRDs are not shown in UI due to permissions issue.
This PR adds ability to provide custom rules for read-only role

When dashboard is started with read-only role, CRDs are not shown in UI due to permissions issue.
This PR adds ability to provide custom rules for read-only role
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 3, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jun 3, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @korjek!

It looks like this is your first PR to kubernetes/dashboard 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/dashboard has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 3, 2022
@desaintmartin
Copy link
Member

Thanks for the contribution!
Wouldn't it be better to add the ability in this case to add in the clusterrole itself the missing permission? I am reluctant to add such deep customization (in the case where someone wants to have its own customized rbacs, it's probably better to do it outside of the chart).

@desaintmartin
Copy link
Member

/assign

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 8, 2022
@korjek
Copy link
Contributor Author

korjek commented Jun 15, 2022

@desaintmartin sorry for the late reply, it fell out of my radar.

Wouldn't it be better to add the ability in this case to add in the clusterrole itself the missing permission?

Not sure that I got the idea. Could you please explain a bit more?

in the case where someone wants to have its own customized rbacs, it's probably better to do it outside of the chart

If someone uses helm to deploy everything, that would mean (if I got your idea correct) creating a custom in-house chart and using it to create role with custom permissions for k8s dashboard. I don't think this is a good way to go.

@desaintmartin
Copy link
Member

@desaintmartin sorry for the late reply, it fell out of my radar.

Wouldn't it be better to add the ability in this case to add in the clusterrole itself the missing permission?

Not sure that I got the idea. Could you please explain a bit more?
Instead of setting a new option and telling users to add CRD permissions in extra RBAC to have a working dashboard, shouldn't it be done by default?

@korjek
Copy link
Contributor Author

korjek commented Jun 16, 2022

Instead of setting a new option and telling users to add CRD permissions in extra RBAC to have a working dashboard, shouldn't it be done by default?

I don't think it's possible, as every CRD has it's own apiGroup.
So with the PR I proposed we have the next lines in values.yaml to be able to see sparkapplications in k8s dashboard:

    clusterReadOnlyRoleAdditionalRules:
      - apiGroups:
        - apiextensions.k8s.io
        resources:
        - customresourcedefinitions
        verbs:
        - get
        - list
        - watch
      - apiGroups:
        - sparkoperator.k8s.io
        resources:
        - sparkapplications
        - sparkapplications/status
        - scheduledsparkapplication
        - scheduledsparkapplication/status
        verbs:
        - get
        - list
        - watch

@korjek
Copy link
Contributor Author

korjek commented Jun 23, 2022

@desaintmartin thoughts?

@korjek
Copy link
Contributor Author

korjek commented Jul 8, 2022

@desaintmartin could we proceed this way? or what other options do we have instead of forking?

@korjek
Copy link
Contributor Author

korjek commented Aug 3, 2022

@shu-mutou maybe you can help here?

@desaintmartin
Copy link
Member

Sorry for the huge delay. Indeed this makes sense for CRDs.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 16, 2022
@korjek
Copy link
Contributor Author

korjek commented Aug 16, 2022

@desaintmartin thank you!
Resolved conflicts

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Aug 16, 2022
@desaintmartin
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 16, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: desaintmartin, korjek

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 16, 2022
@k8s-ci-robot k8s-ci-robot merged commit 4795a8f into kubernetes:master Aug 16, 2022
@korjek korjek deleted the rbac-ro-custom-rules branch August 16, 2022 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants