kubectl
kubectl copied to clipboard
Could we add a shorthand for --field-selector in kubectl?
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)
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.
It looks reasonable. However, I'm wondering whether this was intentional decision due to some reasons. /transfer kubectl
/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.
This is totally parsed by the program, as opposed to the file path that is usually parsed by the kernel/operating system.
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 https://github.com/kubernetes/kubernetes/pull/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 https://github.com/kubernetes/kubernetes/pull/127345 to implement it, could you please take a look?
/kind feature
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.
JFYI https://github.com/kubernetes/kubernetes/pull/127345 was closed due to inactivity . It should be reopened if it is still awaiting reviews and the feature is useful.
JFYI kubernetes/kubernetes#127345 was closed due to inactivity . It should be reopened if it is still awaiting reviews and the feature is useful.
Reopened it.
Let's keep the PR closed, and gauge the interest behind this particular feature. As Marly pointed out earlier there are several considerations (overlap with -f, interest to name the few) that I'd like to learn more, before we make the final decision.
/triage needs-information
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
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:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle rotten - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten