-
Notifications
You must be signed in to change notification settings - Fork 185
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
Bug 2052923:[release-4.13] remove all wildcard permissions in rbacs #1967
base: main
Are you sure you want to change the base?
Conversation
@parth-gr: This pull request references Bugzilla bug 2052923, which is valid. No validations were run on this bugNo GitHub users were found matching the public email listed for the QA contact in Bugzilla ([email protected]), skipping review request. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
enum : - '*', still need to look upon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two more verbs that may need to be considered:
watch
: Likely needed on many of the resourcesdeletecollection
: Not likely needed, unless the ocs operator is deleting multiple resources based on a label, or all resources in a namespace, etc.
Sure |
@@ -382,6 +432,8 @@ spec: | |||
- patch | |||
- update | |||
- watch | |||
- deletecollection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add the permissions where wildcards were not being used before. In this case, there was no wilcard for the verb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
- watch | ||
- deletecollection | ||
- create |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to duplicate some of these permissions that are already specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are still duplicated
@@ -394,6 +446,8 @@ spec: | |||
- patch | |||
- update | |||
- watch | |||
- deletecollection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@malayparida2000 Do you know of any places the OCS operator needs to delete multiple resources in a single API call? If not, the deletecollection
would not be needed to add when removing the wildcard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamniting ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont beleive if we are deleting collections anywhere in the ocs-operator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please check the controller when removing the asterisk permissions? We should evaluate whether we actually require all of them, and if not, we can add only the necessary ones.
@@ -382,6 +432,8 @@ spec: | |||
- patch | |||
- update | |||
- watch | |||
- deletecollection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@@ -394,6 +446,8 @@ spec: | |||
- patch | |||
- update | |||
- watch | |||
- deletecollection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont beleive if we are deleting collections anywhere in the ocs-operator
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: parth-gr 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 |
With this change, we are planning for changing from * to all required permission and would think of restricting to specifics in the future. |
@@ -382,6 +427,7 @@ spec: | |||
- patch | |||
- update | |||
- watch | |||
- watch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
watch
is duplicated in several places here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching it,
Tried to update all the places, please have a look once again
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
- watch | ||
- deletecollection | ||
- create |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are still duplicated
36e34a9
to
6f35d74
Compare
I think as of now it would be easy to do that as we will have to look for fewer permissions (only the ones where * is present) for now. If we decide to do it later we will have to look for all the permissions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please fix the commit-msg as well? It looks like it is in 2 lines.
config/rbac/role.yaml
Outdated
- apiGroups: | ||
- storage.k8s.io | ||
resources: | ||
- storageclasses | ||
verbs: | ||
- '*' | ||
- create |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are duplicates too, All of these are already present here.
config/rbac/role.yaml
Outdated
@@ -23,7 +23,13 @@ rules: | |||
- replicasets | |||
- statefulsets | |||
verbs: | |||
- '*' | |||
- create |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you pls fix the indentation? There is one extra space.
rbac/rook-monitor-role.yaml
Outdated
verbs: | ||
- '*' | ||
- create |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix the indentation here as well?
metrics/deploy/rbac.yaml
Outdated
verbs: | ||
- '*' | ||
- create |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix the indentation here as well?
@parth-gr: This pull request references Bugzilla bug 2052923, which is valid. No validations were run on this bugNo GitHub users were found matching the public email listed for the QA contact in Bugzilla ([email protected]), skipping review request. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
config/rbac/role.yaml
Outdated
- list | ||
- patch | ||
- update | ||
- watch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- watch
looks indented an extra space in many places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
config/rbac/role.yaml
Outdated
- list | ||
- patch | ||
- update | ||
- watch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@parth-gr It looks like you are changing the files under deploy manually. That's why CI is failing. You can auto-generate the changes using |
Running this make gen-latest-csv and FUSION=true make gen-latest-csv makes the changes back to use wildcard |
So basically these look automated files, |
These files are generated from the config dir and the rook CSV. If the rook CSV has wildcards we need to solve there themselves. For now, let's not update the files under deploy manually. Updating them manually will not help us as they will be reverted back while generating a build. Also, CI won't allow us to merge such PR. |
Thanks |
rbac/rook-monitor-role.yaml
Outdated
@@ -6,6 +6,27 @@ rules: | |||
- apiGroups: | |||
- monitoring.coreos.com | |||
resources: | |||
- '*' | |||
- cephclients |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if these resources really belongs to the monitoring.coreos.com
. If I am not mistaken they belong to the ceph.rook.io
. @umangachapagain Can you pls guide @parth-gr What resources should come under the monitoring.coreos.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only care about servicemonitors
and prometheusrules
AFAIR for monitoring.
Link to CRD def: https://github.com/prometheus-operator/kube-prometheus/tree/main/manifests/setup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay thanks
Signed-off-by: parth-gr <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only wildcards were related to the prometheus resources? Previously your PR had many more wildcards updated.
If I am running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@parth-gr: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
remove all wildcard permissions in rbacs