kubernetes / kubectl

Issue tracker and mirror of kubectl code
Apache License 2.0
2.85k stars 920 forks source link

Enhance output message in kubectl command with filters #1523

Open sauravmndl opened 10 months ago

sauravmndl commented 10 months ago

What would you like to be added:

Why is this needed: What would you like to be added: when execute some command like this with filter kubectl get pods -n mynamesapce --field-selector status.phase=Pending -o wide

and returns no output like

No resources found in mynamesapce namespace.

This indicates nothing found in the namesapce. But actually with provided filter no resource found. Resources are there.

Why is this needed:

Message like this will be better No resources found in mynamesapce namespace with applied filter. or No resources found in mynamesapce namespace with applied conditions. If it is specific for namespace in mynamesapce namespace. then should clearly call out with condition/filter.

k8s-ci-robot commented 10 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.
sauravmndl commented 10 months ago

@ardaguclu Please don't close this without analysis. It is not a duplicate ask of https://github.com/kubernetes/kubectl/issues/1485

ardaguclu commented 10 months ago

Sorry, you are right, it seems that this is slightly different than the other. Basically, your request is about enriching https://github.com/kubernetes/kubernetes/blob/d61cbac69aae97db1839bd2e0e86d68f26b353a7/staging/src/k8s.io/kubectl/pkg/cmd/get/get.go#L565 based on the filtered condition. There might be some side effects and possible questions with respect to this;

k8s-triage-robot commented 7 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 6 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

Ritikaa96 commented 2 months ago

Sorry, you are right, it seems that this is slightly different than the other. Basically, your request is about enriching https://github.com/kubernetes/kubernetes/blob/d61cbac69aae97db1839bd2e0e86d68f26b353a7/staging/src/k8s.io/kubectl/pkg/cmd/get/get.go#L565 based on the filtered condition. There might be some side effects and possible questions with respect to this;

  • What will be the output for filtered but not namespaced resources?
  • What if user filters in namespace but resource doesn't exist not only in filtered domain, but also in that namespace. What would be the expected output?

I agree with the questions, also there can be many more . I think if we put filters on we already expect the list as per our condition so output is technically right "No resources found" for our search i.e. using filters. this is same condition as when we search for pods in one namespace and get 0 however its not that cluster doesn't have pods , its just the result as per our search.

I guess the person searching for pods as per conditions will understand the result anyways.