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

Add validation when removing cluster-scope resources and providing namespace #62167

Closed
wants to merge 1 commit into from

Conversation

soltysh
Copy link
Contributor

@soltysh soltysh commented Apr 5, 2018

What this PR does / why we need it:
This pr prevents use-cases such as kubectl delete ns --all -n xyz by verifying if a cluster-scope resource is provided with a namespace parameter.

@kubernetes/sig-cli-pr-reviews wdyt about this approach?

Release note:

Add additional validation when removing cluster-scoped resources

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 5, 2018
@liggitt
Copy link
Member

liggitt commented Apr 5, 2018

this is a breaking change, correct?

@soltysh
Copy link
Contributor Author

soltysh commented Apr 5, 2018

this is a breaking change, correct?

Yes, I'm still struggling whether this is a good approach but I couldn't come up with a better one. I want to provide some sort of diligence when removing cluster-scoped resources here.

@CaoShuFeng
Copy link
Contributor

/test pull-kubernetes-integration
/test pull-kubernetes-e2e-kops-aws
/test pull-kubernetes-e2e-gce

@CaoShuFeng
Copy link
Contributor

Test ok in my environment.

@CaoShuFeng
Copy link
Contributor

Looks like this change breaks:

kubectl delete "${kube_flags[@]}" rolebindings,role,clusterroles,clusterrolebindings -n some-other-random -l test-cmd=auth

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: soltysh

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@soltysh
Copy link
Contributor Author

soltysh commented Apr 6, 2018

Updated.

@@ -5195,7 +5195,8 @@ runTests() {
kube::test::get_object_assert 'clusterrolebindings -l test-cmd=auth' "{{range.items}}{{$id_field}}:{{end}}" 'testing-CRB:'
kube::test::get_object_assert 'clusterroles -l test-cmd=auth' "{{range.items}}{{$id_field}}:{{end}}" 'testing-CR:'

kubectl delete "${kube_flags[@]}" rolebindings,role,clusterroles,clusterrolebindings -n some-other-random -l test-cmd=auth
Copy link
Member

Choose a reason for hiding this comment

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

I actually think uses like this are exactly the reason we shouldn't make this breaking change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't feel too strong in any direction, to be honest.

@k8s-ci-robot
Copy link
Contributor

@soltysh: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-kops-aws f444622 link /test pull-kubernetes-e2e-kops-aws
pull-kubernetes-e2e-gce f444622 link /test pull-kubernetes-e2e-gce

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.

@soltysh
Copy link
Contributor Author

soltysh commented Apr 10, 2018

Based on the feedback I think we'll want to provide something like #17740, instead.

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. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. 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.

5 participants