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

This change add nonResourceURL to kubectl auth cani #46432

Merged

Conversation

CaoShuFeng
Copy link
Contributor

Release note:

support nonResourceURL to kubectl auth cani

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 25, 2017
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels May 25, 2017
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 25, 2017
@k8s-ci-robot
Copy link
Contributor

Hi @CaoShuFeng. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with @k8s-bot 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.

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.

@CaoShuFeng
Copy link
Contributor Author

@deads2k

errors := []error{}
return utilerrors.NewAggregate(errors)
if o.NonResourceURL != "" && o.Subresource != "" {
return fmt.Errorf("--subresource can not be used with nonResourceURL")
Copy link
Contributor

Choose a reason for hiding this comment

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

neither can resources or resourceNames

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Subresource: o.Subresource,
Name: o.ResourceName,
var sar *authorizationapi.SelfSubjectAccessReview
if o.Resource != (schema.GroupVersionResource{}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we should check for the presence of a nonresourceurl instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@deads2k
Copy link
Contributor

deads2k commented May 26, 2017

Minor comments. I like the way it works.

@fabianofranz any comment on usage?

@@ -57,7 +57,7 @@ var (
Check whether an action is allowed.

VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc.
TYPE is a Kubernetes resource. Shortcuts and groups will be resolved.
TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. If start with "/", TYPE will be treated as nonResourceURL.
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to adjust the command usage to add the new arg type, something like:

 kubectl auth can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

# Check to see if I can read pod logs
kubectl auth can-i get pods --subresource=log

# Check to see if I can access url /logs/
Copy link
Contributor

Choose a reason for hiding this comment

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

Check to see if I can access the URL "/logs"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -57,7 +57,7 @@ var (
Check whether an action is allowed.

VERB is a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc.
TYPE is a Kubernetes resource. Shortcuts and groups will be resolved.
TYPE is a Kubernetes resource. Shortcuts and groups will be resolved. If start with "/", TYPE will be treated as nonResourceURL.
Copy link
Contributor

Choose a reason for hiding this comment

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

Here in the description refer to it as a "Non-Resource URL".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@deads2k
Copy link
Contributor

deads2k commented May 31, 2017

@k8s-bot ok to test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 31, 2017
@deads2k
Copy link
Contributor

deads2k commented May 31, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 31, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CaoShuFeng, deads2k

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 31, 2017
@CaoShuFeng
Copy link
Contributor Author

@k8s-bot pull-kubernetes-kubemark-e2e-gce test this
@k8s-bot pull-kubernetes-verify test this
@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this

@CaoShuFeng
Copy link
Contributor Author

@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this

@deads2k deads2k added this to the v1.7 milestone Jun 1, 2017
@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@foxish
Copy link
Contributor

foxish commented Jun 2, 2017

@k8s-bot pull-kubernetes-verify test this
@k8s-bot pull-kubernetes-node-e2e test this

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jun 2, 2017

@CaoShuFeng: The following test(s) failed:

Test name Commit Details Rerun command
pull-kubernetes-federation-e2e-gce 3bf3a03 link @k8s-bot pull-kubernetes-federation-e2e-gce test this
pull-kubernetes-unit 3bf3a03 link @k8s-bot pull-kubernetes-unit test this

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 46432, 46701, 46326, 40848, 46396)

@k8s-github-robot k8s-github-robot merged commit 54cf289 into kubernetes:master Jun 2, 2017
@CaoShuFeng CaoShuFeng deleted the can-i-non-resource-url branch November 6, 2017 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants