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

Subject access review tests #547

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

martinhesko
Copy link
Contributor

based on User guide: Kubernetes RBAC for service authorization

Added the interface for ClusterRole and ClusterRoleBinding.
For the test I added TokenReview authentication and SubjectAccessReview based on the username.
The test setup creates 2 service accounts, with one bound to the ClusterRole permitting it to access the /get endpoint.

@martinhesko martinhesko linked an issue Sep 25, 2024 that may be closed by this pull request
2 tasks
testsuite/kubernetes/cluster_role.py Outdated Show resolved Hide resolved
cls,
cluster,
name,
rules: Optional[List[Dict[str, Any]]] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it's possible to structure and pass these rules as a @dataclass? Or their structure is too complex?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I experimented with this but due to the ClusterRole rules definition having so many parameters it's a problem not having them show up in the resulting object.

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

Successfully merging this pull request may close these issues.

Add Kubernetes SubjectAccessReview test
3 participants