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

Bug 2052923:[release-4.13] remove all wildcard permissions in rbacs #1967

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

Conversation

parth-gr
Copy link
Member

@parth-gr parth-gr commented Mar 21, 2023

remove all wildcard permissions in rbacs

@openshift-ci openshift-ci bot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Mar 21, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 21, 2023

@parth-gr: This pull request references Bugzilla bug 2052923, which is valid.

No validations were run on this bug

No GitHub users were found matching the public email listed for the QA contact in Bugzilla ([email protected]), skipping review request.

In response to this:

Bug 2052923:[release-4.13] remove all wildcard permissions in rbac de…

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
Copy link
Member Author

enum : - '*', still need to look upon

Copy link
Contributor

@travisn travisn left a 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 resources
  • deletecollection: Not likely needed, unless the ocs operator is deleting multiple resources based on a label, or all resources in a namespace, etc.

@parth-gr
Copy link
Member Author

Two more verbs that may need to be considered:

  • watch: Likely needed on many of the resources
  • deletecollection: 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
Copy link
Contributor

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.

Copy link
Member

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
Copy link
Contributor

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

Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

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

Copy link
Member

@iamniting iamniting left a 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
Copy link
Member

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
Copy link
Member

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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 31, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: parth-gr
Once this PR has been reviewed and has the lgtm label, please ask for approval from iamniting. For more information see the Kubernetes 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

@parth-gr
Copy link
Member Author

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.

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
Copy link
Contributor

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

Copy link
Member Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

these are still duplicated

@parth-gr parth-gr force-pushed the wildcard-ocs branch 3 times, most recently from 36e34a9 to 6f35d74 Compare March 31, 2023 14:39
@parth-gr parth-gr requested a review from travisn March 31, 2023 14:40
@iamniting
Copy link
Member

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.

With this change, we are planning for changing from * to all required permission and would think of restricting to specifics in the future.

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.

Copy link
Member

@iamniting iamniting left a 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.

- apiGroups:
- storage.k8s.io
resources:
- storageclasses
verbs:
- '*'
- create
Copy link
Member

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.

@@ -23,7 +23,13 @@ rules:
- replicasets
- statefulsets
verbs:
- '*'
- create
Copy link
Member

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.

verbs:
- '*'
- create
Copy link
Member

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?

verbs:
- '*'
- create
Copy link
Member

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 parth-gr changed the title Bug 2052923:[release-4.13] remove all wildcard permissions in rbac de… Bug 2052923:[release-4.13] remove all wildcard permissions in rbacs Apr 3, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 3, 2023

@parth-gr: This pull request references Bugzilla bug 2052923, which is valid.

No validations were run on this bug

No GitHub users were found matching the public email listed for the QA contact in Bugzilla ([email protected]), skipping review request.

In response to this:

Bug 2052923:[release-4.13] remove all wildcard permissions in rbacs

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.

- list
- patch
- update
- watch
Copy link
Contributor

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

Copy link
Member

Choose a reason for hiding this comment

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

+1

- list
- patch
- update
- watch
Copy link
Member

Choose a reason for hiding this comment

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

+1

@iamniting
Copy link
Member

@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 make gen-latest-csv and FUSION=true make gen-latest-csv.

@parth-gr
Copy link
Member Author

parth-gr commented Apr 4, 2023

FUSION=true make gen-latest-csv

Running this make gen-latest-csv and FUSION=true make gen-latest-csv makes the changes back to use wildcard

@parth-gr
Copy link
Member Author

parth-gr commented Apr 4, 2023

So basically these look automated files,
So from where these files are generated so I can apply the changes there
@iamniting

@iamniting
Copy link
Member

So basically these look automated files, So from where these files are generated so I can apply the changes there @iamniting

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.

@parth-gr
Copy link
Member Author

parth-gr commented Apr 4, 2023

So basically these look automated files, So from where these files are generated so I can apply the changes there @iamniting

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

@@ -6,6 +6,27 @@ rules:
- apiGroups:
- monitoring.coreos.com
resources:
- '*'
- cephclients
Copy link
Member

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

Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay thanks

Copy link
Contributor

@travisn travisn left a 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.

@parth-gr
Copy link
Member Author

parth-gr commented Apr 5, 2023

The only wildcards were related to the prometheus resources? Previously your PR had many more wildcards updated.

If I am running make gen-latest-csv and FUSION=true make gen-latest-csv they all get reverted,
It because the deploy files are auto created

@iamniting
Copy link
Member

Hi @parth-gr We will require few more changes

  1. We need to remove permissions from the CSV merger tool here
  2. We need to add the same permissions here

Copy link
Member

@iamniting iamniting left a comment

Choose a reason for hiding this comment

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

Hi @parth-gr We will require few more changes

We need to remove permissions from the CSV merger tool here
We need to add the same permissions here

Let me know if you need help we can meet and get it sorted.

@parth-gr
Copy link
Member Author

parth-gr commented Apr 6, 2023

Hi @parth-gr We will require few more changes
We need to remove permissions from the CSV merger tool here
We need to add the same permissions here

Let me know if you need help we can meet and get it sorted.

Sure will meet you tmr, thanks

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 1, 2023
@openshift-merge-robot
Copy link
Contributor

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.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 17, 2023

@parth-gr: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/ci-bundle-ocs-operator-bundle fd9fd0e link true /test ci-bundle-ocs-operator-bundle
ci/prow/ocs-operator-bundle-e2e-aws fd9fd0e link true /test ocs-operator-bundle-e2e-aws

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants