Kubectl: --recursive option with wildcards or regexes

Created on 26 Jul 2018  路  1Comment  路  Source: kubernetes/kubectl

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see http://kubernetes.io/docs/troubleshooting/.): No

What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.): recursive resource management kubernetes


Is this a BUG REPORT or FEATURE REQUEST? (choose one): Feature request

I think it would be nice if we could specify a wildcard or regex when using kubectl [command] -f --recursive, like: kubectl apply -f . -R --regex *-resources.yml, so kubectl wouldn't try to parse other .yml files on file tree.

Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-21T09:17:39Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-21T09:05:37Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

Environment:

  • Cloud provider or hardware configuration: Local environment, Macbook Pro 2015
  • OS (e.g. from /etc/os-release): MacOS 10.13.1 High Sierra
  • Kernel (e.g. uname -a): 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64

What happened:
When I tried to apply some configs using the --recursive option, kubectl tried to parse some other .yml files on my file tree.

What you expected to happen:
I expected an option that allowed me to specify what files I should ignore or lookup for.

How to reproduce it (as minimally and precisely as possible):
kubectl apply -f . -R in any directory that has kubernetes resource manifests and other .yml or .json files.

Anything else we need to know:

Most helpful comment

rather than building complex file finding function into kubectl, I'd recommend combining with a more powerful tool like find and piping the results to kubectl:

find . -name *-resources.yml | xargs -n 1 kubectl apply -f

>All comments

rather than building complex file finding function into kubectl, I'd recommend combining with a more powerful tool like find and piping the results to kubectl:

find . -name *-resources.yml | xargs -n 1 kubectl apply -f
Was this page helpful?
0 / 5 - 0 ratings

Related issues

alkar picture alkar  路  6Comments

whs-dot-hk picture whs-dot-hk  路  6Comments

ZhilinS picture ZhilinS  路  5Comments

pwittrock picture pwittrock  路  6Comments

cbluth picture cbluth  路  6Comments