Skip to content

Fix: Ensure resource names in ClusterRole are plural and lowercase #50370

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Ajayss04
Copy link

@Ajayss04 Ajayss04 commented Apr 2, 2025

Description

Resource names in RBAC must be specified in their plural and lowercase form.
Previously, using a singular resource name caused issues with ClusterRole bindings.
This update clarifies the requirement in rbac.md to prevent similar errors in the future.

Issue

#50352

Closes: #50352

… lowercase

Resource names in RBAC must be specified in their plural and lowercase form.  
Previously, using a singular resource name caused issues with ClusterRole bindings.  
This update clarifies the requirement in rbac.md to prevent similar errors in the future.
Copy link

linux-foundation-easycla bot commented Apr 2, 2025

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 Apr 2, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @Ajayss04!

It looks like this is your first PR to kubernetes/website 🎉. 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/website 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 language/en Issues or PRs related to English language label Apr 2, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign katcosgrove for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 requested review from deads2k and liggitt April 2, 2025 16:02
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. 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 Apr 2, 2025
Copy link

netlify bot commented Apr 2, 2025

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit ff1ee07
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/67ed5f9eaf5dd2000810850f
😎 Deploy Preview https://deploy-preview-50370--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@lmktfy
Copy link
Contributor

lmktfy commented Apr 11, 2025

/sig auth

@k8s-ci-robot k8s-ci-robot added the sig/auth Categorizes an issue or PR as relevant to SIG Auth. label Apr 11, 2025
Copy link
Member

@liggitt liggitt left a comment

Choose a reason for hiding this comment

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

This isn't really specific to RBAC, so it might also be worth clarifying on this page https://kubernetes.io/docs/reference/access-authn-authz/authorization/#request-attributes-used-in-authorization

But I don't object to repeating the details here.

Comment on lines +345 to +347
Note: When specifying resources in a ClusterRole or Role, always use the plural and lowercase form of the resource name.
For example, use pods instead of pod, services instead of service.
Incorrect resource names will cause RBAC policies to fail.
Copy link
Member

Choose a reason for hiding this comment

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

The important part is that it match the REST API URL, which for built-in types is always plural and lowercase, but might not be for aggregated API servers.

Suggested change
Note: When specifying resources in a ClusterRole or Role, always use the plural and lowercase form of the resource name.
For example, use pods instead of pod, services instead of service.
Incorrect resource names will cause RBAC policies to fail.
Note: When specifying resources in a ClusterRole or Role, always use the resource exactly as it appears in the REST API path segment.
For example, use `pods` instead of `pod` or `Pods`.
Resources that do not exactly match the REST API path segment will not authorize the request.

@enj enj added this to SIG Auth Apr 12, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in SIG Auth Apr 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language sig/auth Categorizes an issue or PR as relevant to SIG Auth. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

Page update request
4 participants