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

Allow a wildcard in identifying a name (shown with an example) #1685

Open
mpattani opened this issue Nov 26, 2024 · 5 comments
Open

Allow a wildcard in identifying a name (shown with an example) #1685

mpattani opened this issue Nov 26, 2024 · 5 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/cli Categorizes an issue or PR as relevant to SIG CLI.

Comments

@mpattani
Copy link

Enhancement Description

Allow a wildcard (* OR %) for long podnames for those who do not like to do copy/paste

Here is my example i am talking about:

I only have two pods, but they have long names. Instead of doing copy/paste of the whole podname, I would like
to have to get the whole name by using a wild card-

Here is my scenerio

++++++++++++

[sysadmin@localhost mp_k8s_exercise]$ kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
helloworld-cc47658f5-zs9nq 1/1 Running 0 17d 10.1.102.152 localhost.localdomain
nginx-webserver-7fc8bbdbb7-twmhg 1/1 Running 0 18d 10.1.102.148 localhost.localdomain
[sysadmin@localhost mp_k8s_exercise]$
[sysadmin@localhost mp_k8s_exercise]$
[sysadmin@localhost mp_k8s_exercise]$ kubectl exec nginx* -- cat /etc/hosts
Error from server (NotFound): pods "nginx*" not found
[sysadmin@localhost mp_k8s_exercise]$
[sysadmin@localhost mp_k8s_exercise]$ kubectl exec nginx-webserver-* -- cat /etc/hosts
Error from server (NotFound): pods "nginx-webserver-*" not found
[sysadmin@localhost mp_k8s_exercise]$
[sysadmin@localhost mp_k8s_exercise]$ kubectl exec nginx-webserver-7fc8bbdbb7-twmhg -- cat /etc/hosts

Kubernetes-managed hosts file.

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
10.1.102.148 nginx-webserver-7fc8bbdbb7-twmhg
[sysadmin@localhost mp_k8s_exercise]$ pwd
/home/sysadmin/mp_k8s_exercise
[sysadmin@localhost mp_k8s_exercise]$

+++++++++++++

What I would have liked to see is if i could what i was trying to do earlier:


[sysadmin@localhost mp_k8s_exercise]$ kubectl exec nginx* -- cat /etc/hosts (* for all chars following nginx*) (% for single char )
Error from server (NotFound): pods "nginx*" not found
[sysadmin@localhost mp_k8s_exercise]$
[sysadmin@localhost mp_k8s_exercise]$ kubectl exec nginx-webserver-* -- cat /etc/hosts
Error from server (NotFound): pods "nginx-webserver-*" not found
[sysadmin@localhost mp_k8s_exercise]$


I should be able to use a wild card like (* for all chars - and % for single char) to get the rest of the podname -

As far as there is no conflict, kubectl should be able to give me and identify long podnames by using wildcard.

I believe this will be beneficial to all kubectl users - not just me who is not always comfortable doing copy/paste.

I hope this reaches to the right team.

Regards
MPattani

@k8s-ci-robot
Copy link
Contributor

There are no sig labels on this issue. Please add an appropriate label by using one of the following commands:

  • /sig <group-name>
  • /wg <group-name>
  • /committee <group-name>

Please see the group list for a listing of the SIGs, working groups, and committees available.

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.

@k8s-ci-robot k8s-ci-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Nov 26, 2024
@sftim
Copy link
Contributor

sftim commented Dec 10, 2024

I think the best home for this is as a kubectl feature request @mpattani

/transfer kubectl

@k8s-ci-robot k8s-ci-robot transferred this issue from kubernetes/enhancements Dec 10, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Dec 10, 2024
@k8s-ci-robot
Copy link
Contributor

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. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@sftim
Copy link
Contributor

sftim commented Dec 10, 2024

/sig cli
/kind feature

@k8s-ci-robot k8s-ci-robot added sig/cli Categorizes an issue or PR as relevant to SIG CLI. kind/feature Categorizes issue or PR as related to a new feature. labels Dec 10, 2024
@sftim
Copy link
Contributor

sftim commented Dec 10, 2024

  • we recommend using labels to select multiple Pods
  • could an out-of-tree plugin help exec the same command across multiple Pods matching a label?

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. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/cli Categorizes an issue or PR as relevant to SIG CLI.
Projects
None yet
Development

No branches or pull requests

3 participants