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

fix: check RBAC to watched resources on startup #134

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

erikgb
Copy link
Contributor

@erikgb erikgb commented Jun 8, 2024

This PR adds more validation of configuration on startup. The operator must have cluster-wide RBAC to CRUD all configured watches to function as intended by the user. At startup, we will now use SelfSubjectAccessReview to check the required RBAC for all configured watches and crash if anything is missing.

Note: After migrating to SSA, we no longer need the update verb. I included this minor change in this PR, but please let me know if a dedicated PR is required.

Close #102

Copy link
Member

@zoetrope zoetrope left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!
Would it be difficult to add tests for this feature?

@erikgb
Copy link
Contributor Author

erikgb commented Jun 10, 2024

Thanks for the PR! Would it be difficult to add tests for this feature?

I thought about tests when preparing the PR, and I think it's a bit more difficult than usual. But I agree there should ideally be tests for everything and will take another look!

@erikgb erikgb marked this pull request as draft June 10, 2024 08:51
@erikgb erikgb force-pushed the validate-rbac branch 2 times, most recently from 76d5e49 to 6f6f68c Compare June 10, 2024 19:02
@erikgb erikgb marked this pull request as ready for review June 10, 2024 19:03
@erikgb
Copy link
Contributor Author

erikgb commented Jun 10, 2024

I have now added some initial tests to this feature. Please let me know if more detailed testing is required.

@zoetrope
Copy link
Member

@erikgb
Thanks!

@zoetrope zoetrope merged commit e09d427 into cybozu-go:main Jun 14, 2024
8 checks passed
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.

Operator should crash if missing RBAC to any watched resource
2 participants