-
Notifications
You must be signed in to change notification settings - Fork 379
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
minimize rbac permission by setting secrets as optional #130
Conversation
Welcome @hoyho! |
Hi @hoyho. Thanks for your PR. I'm waiting for a kubernetes-csi or kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
deploy/kubernetes/rbac.yaml
Outdated
@@ -51,6 +51,14 @@ rules: | |||
resources: ["customresourcedefinitions"] | |||
verbs: ["create", "list", "watch", "delete", "get", "update"] | |||
|
|||
#Secret permission is optional. |
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.
Add a space after #
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 the advice.
deploy/kubernetes/rbac.yaml
Outdated
@@ -51,6 +51,14 @@ rules: | |||
resources: ["customresourcedefinitions"] | |||
verbs: ["create", "list", "watch", "delete", "get", "update"] | |||
|
|||
#Secret permission is optional. | |||
#Enable it if you need value from secret. |
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.
s/if you need value from secret/if your driver needs secret
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.
fixed
deploy/kubernetes/rbac.yaml
Outdated
@@ -51,6 +51,14 @@ rules: | |||
resources: ["customresourcedefinitions"] | |||
verbs: ["create", "list", "watch", "delete", "get", "update"] | |||
|
|||
#Secret permission is optional. | |||
#Enable it if you need value from secret. | |||
#For example, you have key `csi.storage.k8s.io/controller-publish-secret-name` in StorageClass.parameters. |
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.
For example, csi.storage.k8s.io/snapshotter-secret-name
is set in VolumeSnapshotClass.
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.
fixed
/ok-to-test |
deploy/kubernetes/rbac.yaml
Outdated
# Secret permission is optional. | ||
# Enable it if your driver needs secret. | ||
# For example, `csi.storage.k8s.io/snapshotter-secret-name` is set in VolumeSnapshotClass. | ||
# See https://kubernetes-csi.github.io/docs/secrets-and-credentials.html for more details. |
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.
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.
updated
e1cddee
to
dc72235
Compare
deploy/kubernetes/rbac.yaml
Outdated
- apiGroups: [""] | ||
resources: ["secrets"] | ||
verbs: ["get", "list"] | ||
# Secret permission is optional. |
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 think you need to add space and make sure this aligns with - apiGroups: [""] on line 32. yaml file is space sensitive.
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.
Actually, no need to worry about that. Comment lines in yaml file will be ignored. I have test it and it can apply/create. In case of some CO may have different behavior, I also update the yaml file as you suggested
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hoyho, xing-yang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…ncy-openshift-4.16-ose-csi-snapshot-controller OCPBUGS-25124: Updating ose-csi-snapshot-controller-container image to be consistent with ART
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Set secret rbac as optional.
Some drivers may require a secret while some don't.
By default, we should give less permission as possible because
ClusterRole
is quite a broad.Other sidecars like external-provisioner and external-attacher have comment out that. It should be ok to do it in external-snapshotter.
ref https://kubernetes-csi.github.io/docs/secrets-and-credentials.html#secret-rbac-rules
related issue kubernetes-csi/external-provisioner#164
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: