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

Could we add a shorthand for --field-selector in kubectl? #1649

Open
tnqn opened this issue Sep 9, 2024 · 7 comments · May be fixed by kubernetes/kubernetes#127345
Open

Could we add a shorthand for --field-selector in kubectl? #1649

tnqn opened this issue Sep 9, 2024 · 7 comments · May be fixed by kubernetes/kubernetes#127345
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. sig/cli Categorizes an issue or PR as relevant to SIG CLI. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@tnqn
Copy link
Member

tnqn commented Sep 9, 2024

What happened?

I’m wondering if the --field-selector option is used frequently enough to justify a shorthand like -F. In our extension API server, we have a field that users need to specify to limit objects within a particular scope, but --field-selector feels a bit lengthy to type compared to the -l shorthand for label selectors. Would it make sense to add a shorthand for --field-selector?

Creating the issue to gather some feedback before introducing such a shorthand as suggested by @soltysh.

The original thread in sig-cli slack channel: https://kubernetes.slack.com/archives/C2GL57FJ4/p1725613426106679

cc @soltysh @apelisse

/sig cli

What did you expect to happen?

A shorthand can be used to filter objects by field selector, such as kubectl get FOO -F .spec.region=BAR.

How can we reproduce it (as minimally and precisely as possible)?

NONE

Anything else we need to know?

No response

Kubernetes version

$ kubectl version
# paste output here

Cloud provider

OS version

# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Install tools

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, ...) and versions (if applicable)

@tnqn tnqn added the kind/bug Categorizes issue or PR as related to a bug. label Sep 9, 2024
@k8s-ci-robot k8s-ci-robot added sig/cli Categorizes an issue or PR as relevant to SIG CLI. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 9, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

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

It looks reasonable. However, I'm wondering whether this was intentional decision due to some reasons.
/transfer kubectl

@k8s-ci-robot k8s-ci-robot transferred this issue from kubernetes/kubernetes Sep 9, 2024
@mpuckett159
Copy link
Contributor

/triage accepted
Need to verify that there will not be collision between -f and -F. This will need to get tested across windows/macOS/various linux distros.

@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 Sep 11, 2024
@apelisse
Copy link
Member

This is totally parsed by the program, as opposed to the file path that is usually parsed by the kernel/operating system.

@tnqn
Copy link
Member Author

tnqn commented Sep 13, 2024

Thank you all for your feedback.

It looks reasonable. However, I'm wondering whether this was intentional decision due to some reasons.

@ardaguclu, I checked kubernetes/kubernetes#50140 which added the flag and didn't find any discussion about the shorthand, I guess it wasn't intentional.

Need to verify that there will not be collision between -f and -F. This will need to get tested across windows/macOS/various linux distros.

@mpuckett159, as @apelisse explains, this is parsed by the program so the flag names are case-sensitive, otherwise the command kubectl get -l <selector> -L <label> would fail.

I created kubernetes/kubernetes#127345 to implement it, could you please take a look?

@soltysh
Copy link
Contributor

soltysh commented Sep 13, 2024

/kind feature

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 13, 2024
@soltysh soltysh removed the kind/bug Categorizes issue or PR as related to a bug. label Sep 13, 2024
@mpuckett159 mpuckett159 added the priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. label Sep 14, 2024
@mpuckett159
Copy link
Contributor

Apologies I misunderstood and we need to wait for more evidence for this before accepting. This issue should be fore gathering more feedback. Sorry for the churn/misunderstanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. sig/cli Categorizes an issue or PR as relevant to SIG CLI. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: Needs Triage
Development

Successfully merging a pull request may close this issue.

6 participants