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

Kubectl auth can-i doesn't know about the approve verb #124880

Closed
raesene opened this issue May 10, 2024 · 12 comments · Fixed by #125131
Closed

Kubectl auth can-i doesn't know about the approve verb #124880

raesene opened this issue May 10, 2024 · 12 comments · Fixed by #125131
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/auth Categorizes an issue or PR as relevant to SIG Auth. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@raesene
Copy link

raesene commented May 10, 2024

What happened:

If you use kubectl auth can-i to test whether a user can approve certificate signing requests, you get a response indicating that approve is not a valid verb

kubectl auth can-i approve certificatesigningrequests.certificates.k8s.io
Warning: resource 'certificatesigningrequests' is not namespace scoped in group 'certificates.k8s.io'

Warning: verb 'approve' is not a known verb

An example of the approve verb being used can be seen here

What you expected to happen:

approve should be recognized as a valid verb on certificatesigningrequest objects.

How to reproduce it (as minimally and precisely as possible):
Run

kubectl auth can-i approve certificatesigningrequests.certificates.k8s.io

Anything else we need to know?:

I think that approve needs to be added to the kubectl auth can-i code here

Environment:

  • Kubernetes client and server versions (use kubectl version):
  • Cloud provider or hardware configuration:
  • OS (e.g: cat /etc/os-release):
@raesene raesene added the kind/bug Categorizes issue or PR as related to a bug. label May 10, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label May 10, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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-sigs/prow repository.

@ardaguclu
Copy link
Member

I don't think approve is a valid verb for kubectl auth command. Valid verbs are in https://github.com/kubernetes/kubectl/blob/514f46729f82412dd9cc41f206058bc4ae9b62b0/pkg/cmd/auth/cani.go#L106

@raesene
Copy link
Author

raesene commented May 13, 2024

so in that line of code there are a number of verbs which are only usuable on specific objects for example impersonate which works on users. AFAIK the point of that line is to inform kubectl what the valid verbs are on any object in Kubernetes, so that it knows what's possible when users use the kubectl auth can-i command.

the approve verb is valid on certificate objects as shown in the docs example I listed. Without approve being present in that line of code, kubectl auth can-i will incorrectly state that there is no approve verb in Kubernetes.

@ah8ad3
Copy link
Member

ah8ad3 commented May 14, 2024

I tested it, seems working when we add approve in that list. But the question is should we add it or not?

@raesene
Copy link
Author

raesene commented May 14, 2024

There have been cases where Kubectl has had additions to handle non-standard resources/verbs in the past (e.g. this one I raised a couple of years back).

AFAIK the explicit list of verbs here is designed to address this point, it's just not got approve in it. You could ask SIG-Auth about it, I'm sure they'd have more info.

@ardaguclu
Copy link
Member

/transfer kubenertes
/sig auth

Decision can be made by sig-auth

@k8s-ci-robot k8s-ci-robot added the sig/auth Categorizes an issue or PR as relevant to SIG Auth. label May 14, 2024
@k8s-ci-robot
Copy link
Contributor

@ardaguclu: Something went wrong or the destination repo kubernetes/kubenertes does not exist.

In response to this:

/transfer kubenertes
/sig auth

Decision can be made by sig-auth

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-sigs/prow repository.

@ardaguclu
Copy link
Member

/transfer kubernetes/kubernetes

@k8s-ci-robot
Copy link
Contributor

@ardaguclu: Something went wrong or the destination repo kubernetes/kubernetes/kubernetes does not exist.

In response to this:

/transfer kubernetes/kubernetes

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-sigs/prow repository.

@ardaguclu
Copy link
Member

/transfer kubernetes

@k8s-ci-robot k8s-ci-robot transferred this issue from kubernetes/kubectl May 15, 2024
@stlaz
Copy link
Member

stlaz commented May 20, 2024

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 20, 2024
@ah8ad3
Copy link
Member

ah8ad3 commented May 26, 2024

This will work even without adding verb there, adding verb just removes the warning. Submitted a PR to add that.
/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/auth Categorizes an issue or PR as relevant to SIG Auth. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: Closed / Done
Development

Successfully merging a pull request may close this issue.

5 participants