kubernetes-sigs / cluster-api-provider-nested

Cluster API Provider for Nested Clusters
Apache License 2.0
299 stars 65 forks source link

Add permission for secret deletecollect #153

Closed vincent-pli closed 3 years ago

vincent-pli commented 3 years ago

What this PR does / why we need it: When I create a ns in tenant cluster then delete I found error raised in syncer 's log, as this:

E0702 05:42:20.820948       1 dws.go:95] failed reconcile secret test/default-token-zp82r DELETE of cluster default-a32f71-vc-sample-1 secrets is forbidden: User "system:serviceaccount:vc-manager:vc-syncer" cannot deletecollection resource "secrets" in API group "" in the namespace "default-a32f71-vc-sample-1-test"

seems we do not assign enough permission to the sa, leak for deletecollection

k8s-ci-robot commented 3 years ago

Hi @vincent-pli. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
christopherhein commented 3 years ago

/ok-to-test

Fei-Guo commented 3 years ago

@vincent-pli What is your super cluster's K8s version?

vincent-pli commented 3 years ago

@Fei-Guo , with Kind

root@rentz1:~# kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCommit:"e19964183377d0ec2052d1f1fa930c4d7575bd50", GitTreeState:"clean", BuildDate:"2020-08-26T14:30:33Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2", GitCommit:"faecb196815e248d3ecfb03c680a4507229c2a56", GitTreeState:"clean", BuildDate:"2021-01-21T01:11:42Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
christopherhein commented 3 years ago

@Fei-Guo are you concerned about backward compatibility w/ this rule?

Fei-Guo commented 3 years ago

@Fei-Guo are you concerned about backward compatibility w/ this rule?

I was wondering why I did not hit this locally. It seems to be a missing configuration and we just did not hit that code path.

Fei-Guo commented 3 years ago

Thanks for finding it out. /lgtm /approve

k8s-ci-robot commented 3 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Fei-Guo, vincent-pli

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: - ~~[virtualcluster/OWNERS](https://github.com/kubernetes-sigs/cluster-api-provider-nested/blob/main/virtualcluster/OWNERS)~~ [Fei-Guo] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment