kubernetes / kubectl

Issue tracker and mirror of kubectl code
Apache License 2.0
2.75k stars 894 forks source link

Remove get all entirely #1584

Closed raxod502-plaid closed 2 months ago

raxod502-plaid commented 2 months ago

This is another copy of https://github.com/kubernetes/kubectl/issues/599 since the linked issue https://github.com/kubernetes/kubectl/issues/151 was incorrectly closed again even though the issue is still an issue and nothing has been done to resolve it.

This is not a bug report nor question, it's a meta issue to reopen another issue.

https://github.com/kubernetes/kubectl/issues/151 is about:

Bad documentation (which is solved now) Kubernetes not having a reasonably simple API to query "ALL" resources in a namespace (which is not resolved yet.) As many commented there that command doesn't work for me too with the same error they reported.

As that issue is not resolved yet and adding comments to a closed issue doesn't bring any attention I create this issue to ask you kindly reopen that issue (and do not close it nor any other issues until they're solved).

k8s-ci-robot commented 2 months ago

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](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.
ah8ad3 commented 2 months ago

There are some limitation that you probably saw in this link and original PR of all. And also these two comments https://github.com/kubernetes/kubectl/issues/151#issuecomment-541483101

The all alias won't be removed for compatibility reasons but has been removed from command help for several releases. I agree it should not be promoted as it is confusing.

https://github.com/kubernetes/kubectl/issues/151#issuecomment-544267182

The all category is entirely specified server-side in discovery docs, and resolved generically client-side like any other category. It's unclear how we would communicate it was deprecated to users of that feature without adding special case logic specific to "all" client-side, which we do not want to do.

I'm putting these for the next person who wants to take a look at this issue.

raxod502-plaid commented 2 months ago

I still have to say I do not understand the claim that "it's unclear how we would communicate it was deprecated". Kubernetes makes breaking changes all the time, there is a supported version skew between client and server versions, and users must read the changelog when upgrading their cluster.

It seems like the responses in that thread are saying "we can literally never remove this for the rest of time", and I just do not understand how that could possibly be the case.

brianpursley commented 2 months ago

I can tell you are frustrated that the original issue was closed, but I'm not sure opening another issue is the best way to communicate the problem.

What is the specific change that you are asking for?

If it is for kubectl get all to return all resources, I think it has already been stated that the argument all is in fact referring to a resource category named "all", and not literally all resources. With kubectl get all, you are in-effect saying "give me all the resources that belong to a category named all".

You can see what I'm talking about if you run kubectl api-resources -o wide using a recent version of kubectl, which shows you the names of the categories to which each resource belongs, if any.

Notice below that only some resources belong to the "all" category (see the last column):

~ $ kubectl api-resources -o wide
NAME                                SHORTNAMES   APIVERSION                        NAMESPACED   KIND                               VERBS                                                        CATEGORIES
bindings                                         v1                                true         Binding                            create                                                       
componentstatuses                   cs           v1                                false        ComponentStatus                    get,list                                                     
configmaps                          cm           v1                                true         ConfigMap                          create,delete,deletecollection,get,list,patch,update,watch   
endpoints                           ep           v1                                true         Endpoints                          create,delete,deletecollection,get,list,patch,update,watch   
events                              ev           v1                                true         Event                              create,delete,deletecollection,get,list,patch,update,watch   
limitranges                         limits       v1                                true         LimitRange                         create,delete,deletecollection,get,list,patch,update,watch   
namespaces                          ns           v1                                false        Namespace                          create,delete,get,list,patch,update,watch                    
nodes                               no           v1                                false        Node                               create,delete,deletecollection,get,list,patch,update,watch   
persistentvolumeclaims              pvc          v1                                true         PersistentVolumeClaim              create,delete,deletecollection,get,list,patch,update,watch   
persistentvolumes                   pv           v1                                false        PersistentVolume                   create,delete,deletecollection,get,list,patch,update,watch   
pods                                po           v1                                true         Pod                                create,delete,deletecollection,get,list,patch,update,watch   all
podtemplates                                     v1                                true         PodTemplate                        create,delete,deletecollection,get,list,patch,update,watch   
replicationcontrollers              rc           v1                                true         ReplicationController              create,delete,deletecollection,get,list,patch,update,watch   all
resourcequotas                      quota        v1                                true         ResourceQuota                      create,delete,deletecollection,get,list,patch,update,watch   
secrets                                          v1                                true         Secret                             create,delete,deletecollection,get,list,patch,update,watch   
serviceaccounts                     sa           v1                                true         ServiceAccount                     create,delete,deletecollection,get,list,patch,update,watch   
services                            svc          v1                                true         Service                            create,delete,deletecollection,get,list,patch,update,watch   all
mutatingwebhookconfigurations                    admissionregistration.k8s.io/v1   false        MutatingWebhookConfiguration       create,delete,deletecollection,get,list,patch,update,watch   api-extensions
validatingadmissionpolicies                      admissionregistration.k8s.io/v1   false        ValidatingAdmissionPolicy          create,delete,deletecollection,get,list,patch,update,watch   api-extensions
validatingadmissionpolicybindings                admissionregistration.k8s.io/v1   false        ValidatingAdmissionPolicyBinding   create,delete,deletecollection,get,list,patch,update,watch   api-extensions
validatingwebhookconfigurations                  admissionregistration.k8s.io/v1   false        ValidatingWebhookConfiguration     create,delete,deletecollection,get,list,patch,update,watch   api-extensions
customresourcedefinitions           crd,crds     apiextensions.k8s.io/v1           false        CustomResourceDefinition           create,delete,deletecollection,get,list,patch,update,watch   api-extensions
apiservices                                      apiregistration.k8s.io/v1         false        APIService                         create,delete,deletecollection,get,list,patch,update,watch   api-extensions
controllerrevisions                              apps/v1                           true         ControllerRevision                 create,delete,deletecollection,get,list,patch,update,watch   
daemonsets                          ds           apps/v1                           true         DaemonSet                          create,delete,deletecollection,get,list,patch,update,watch   all
deployments                         deploy       apps/v1                           true         Deployment                         create,delete,deletecollection,get,list,patch,update,watch   all
replicasets                         rs           apps/v1                           true         ReplicaSet                         create,delete,deletecollection,get,list,patch,update,watch   all
statefulsets                        sts          apps/v1                           true         StatefulSet                        create,delete,deletecollection,get,list,patch,update,watch   all
selfsubjectreviews                               authentication.k8s.io/v1          false        SelfSubjectReview                  create                                                       
tokenreviews                                     authentication.k8s.io/v1          false        TokenReview                        create                                                       
localsubjectaccessreviews                        authorization.k8s.io/v1           true         LocalSubjectAccessReview           create                                                       
selfsubjectaccessreviews                         authorization.k8s.io/v1           false        SelfSubjectAccessReview            create                                                       
selfsubjectrulesreviews                          authorization.k8s.io/v1           false        SelfSubjectRulesReview             create                                                       
subjectaccessreviews                             authorization.k8s.io/v1           false        SubjectAccessReview                create                                                       
horizontalpodautoscalers            hpa          autoscaling/v2                    true         HorizontalPodAutoscaler            create,delete,deletecollection,get,list,patch,update,watch   all
cronjobs                            cj           batch/v1                          true         CronJob                            create,delete,deletecollection,get,list,patch,update,watch   all
jobs                                             batch/v1                          true         Job                                create,delete,deletecollection,get,list,patch,update,watch   all
certificatesigningrequests          csr          certificates.k8s.io/v1            false        CertificateSigningRequest          create,delete,deletecollection,get,list,patch,update,watch   
leases                                           coordination.k8s.io/v1            true         Lease                              create,delete,deletecollection,get,list,patch,update,watch   
endpointslices                                   discovery.k8s.io/v1               true         EndpointSlice                      create,delete,deletecollection,get,list,patch,update,watch   
events                              ev           events.k8s.io/v1                  true         Event                              create,delete,deletecollection,get,list,patch,update,watch   
flowschemas                                      flowcontrol.apiserver.k8s.io/v1   false        FlowSchema                         create,delete,deletecollection,get,list,patch,update,watch   
prioritylevelconfigurations                      flowcontrol.apiserver.k8s.io/v1   false        PriorityLevelConfiguration         create,delete,deletecollection,get,list,patch,update,watch   
ingressclasses                                   networking.k8s.io/v1              false        IngressClass                       create,delete,deletecollection,get,list,patch,update,watch   
ingresses                           ing          networking.k8s.io/v1              true         Ingress                            create,delete,deletecollection,get,list,patch,update,watch   
networkpolicies                     netpol       networking.k8s.io/v1              true         NetworkPolicy                      create,delete,deletecollection,get,list,patch,update,watch   
runtimeclasses                                   node.k8s.io/v1                    false        RuntimeClass                       create,delete,deletecollection,get,list,patch,update,watch   
poddisruptionbudgets                pdb          policy/v1                         true         PodDisruptionBudget                create,delete,deletecollection,get,list,patch,update,watch   
clusterrolebindings                              rbac.authorization.k8s.io/v1      false        ClusterRoleBinding                 create,delete,deletecollection,get,list,patch,update,watch   
clusterroles                                     rbac.authorization.k8s.io/v1      false        ClusterRole                        create,delete,deletecollection,get,list,patch,update,watch   
rolebindings                                     rbac.authorization.k8s.io/v1      true         RoleBinding                        create,delete,deletecollection,get,list,patch,update,watch   
roles                                            rbac.authorization.k8s.io/v1      true         Role                               create,delete,deletecollection,get,list,patch,update,watch   
priorityclasses                     pc           scheduling.k8s.io/v1              false        PriorityClass                      create,delete,deletecollection,get,list,patch,update,watch   
csidrivers                                       storage.k8s.io/v1                 false        CSIDriver                          create,delete,deletecollection,get,list,patch,update,watch   
csinodes                                         storage.k8s.io/v1                 false        CSINode                            create,delete,deletecollection,get,list,patch,update,watch   
csistoragecapacities                             storage.k8s.io/v1                 true         CSIStorageCapacity                 create,delete,deletecollection,get,list,patch,update,watch   
storageclasses                      sc           storage.k8s.io/v1                 false        StorageClass                       create,delete,deletecollection,get,list,patch,update,watch   
volumeattachments                                storage.k8s.io/v1                 false        VolumeAttachment                   create,delete,deletecollection,get,list,patch,update,watch   

Does this help explain why kubectl get all does not return all resources?

If you really need the all behavior, I recommend checking out this plugin to see if it works for you: https://github.com/corneliusweig/ketall

raxod502-plaid commented 2 months ago

I'm not sure opening another issue is the best way to communicate the problem.

Is there a better way? Commenting on the original issue thread would not accomplish anything.

What is the specific change that you are asking for?

As was stated by a large number of people in the original issue thread, the ask is that kubectl get all be removed since it is unofficially deprecated, recommended against, undocumented, and misleading.

Does this help explain why kubectl get all does not return all resources?

Yes, but that is not the question being asked.

sftim commented 2 months ago

As was stated by a large number of people in the original issue thread, the ask is that kubectl get all be removed since it is unofficially deprecated, recommended against, undocumented, and misleading.

You could open a feature request issue calling for that outcome @raxod502-plaid. Consider a title such as: Remove kubectl get all

sftim commented 2 months ago

/remove-kind bug

sftim commented 2 months ago

I don't see that the closure was done by mistake. https://github.com/kubernetes/kubectl/issues/151#issuecomment-402003112 looks intentional.

/priority awaiting-more-evidence

raxod502-plaid commented 2 months ago

The closure may have been "intentional" by the person who executed it, but issue reactions show that 132 people disagreed with that decision, and 0 people agreed with it. Also, it was (correctly) re-opened later upon request in https://github.com/kubernetes/kubectl/issues/599 because the issue was not resolved.

Anyway, I filed https://github.com/kubernetes/kubectl/issues/1591 per your request to have a fourth issue tracking this problem. Let me know if anything else is required.

ardaguclu commented 2 months ago

@raxod502-plaid Due to backwards compatibility issues, I don't think we'll ever remove get all entirely. Yes, it will stay as deprecated and we'll continue recommending people to NOT using it. But we can't simply remove.

This issue is already open, why do you prefer to track this work in another https://github.com/kubernetes/kubectl/issues/1591 issue?.

ardaguclu commented 2 months ago

I think this comment https://github.com/kubernetes/kubectl/issues/1584#issuecomment-2072978941 explains well about the issue and since we can't remove get all. I think, we can also close this issue as won't fix.

raxod502-plaid commented 2 months ago

This issue is already open, why do you prefer to track this work in another https://github.com/kubernetes/kubectl/issues/1591 issue?

I don't prefer that, in fact I think https://github.com/kubernetes/kubectl/issues/1591 is a needless duplicate. The only reason I opened it is because @sftim specifically asked me to do so in https://github.com/kubernetes/kubectl/issues/1584#issuecomment-2073405467.

Due to backwards compatibility issues, I don't think we'll ever remove get all entirely

This does not make sense to me. Could you address https://github.com/kubernetes/kubectl/issues/1584#issuecomment-2049957900?

brianpursley commented 2 months ago

It's not really possible to "deprecate" the all category because it is metadata provided by the resource types.

It's not like there is code in kubectl looking for a keyword of all and choosing only to return those resource types.

Therefore, this isn't even something kubectl can do, and it needs to be raised in the k/k repo for discussion there. I'm not sure which sig that would be, but it is not CLI.

Arguing about it here will accomplish nothing.

raxod502-plaid commented 2 months ago

It's not really possible to "deprecate" the all category because it is metadata provided by the resource types.

I think I see the problem. When statements like this have been made, what was actually meant has been: It's not really possible to "deprecate" the all category in kubectl specifically because it is metadata provided by the resource types, so it's necessary to perform the deprecation on the server side instead.

This issue probably could have been moved along a lot faster if somebody had mentioned before that it had been filed against the wrong tracker, as opposed to just saying "this is impossible", since it clearly isn't impossible to solve the problem.

I've filed https://github.com/kubernetes/kubernetes/issues/124538 and hopefully we can get the ball rolling after 7 years.

brianpursley commented 2 months ago

This issue probably could have been moved along a lot faster if somebody had mentioned before that it had been filed against the wrong tracker, as opposed to just saying "this is impossible", since it clearly isn't impossible to solve the problem.

Everyone here has tried to be helpful 🤷‍♂️

I'm going to go ahead and close this issue, since you now have opened the other one in k/k.

brianpursley commented 2 months ago

/close not-planned /triage duplicate