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

kubectl should process files recursively when given a directory #19767

Closed
ghodss opened this issue Jan 17, 2016 · 4 comments
Closed

kubectl should process files recursively when given a directory #19767

ghodss opened this issue Jan 17, 2016 · 4 comments
Labels
area/app-lifecycle area/kubectl priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@ghodss
Copy link
Contributor

ghodss commented Jan 17, 2016

When given a directory, kubectl apply -f <directory> should search a directory recursively for any JSON|YAML files when given a directory. Currently it only finds the immediate children of the given directory.

I believe kubectl apply is exhibiting the same behavior as kubectl create, kubectl delete, etc., but to enable the original #1702 use case of a nested directory of configuration objects being reconciled with the server's state, kubectl apply especially should act recursively.

Current behavior:

$ ls pod/
pod2.yaml  pod.yaml
$ kubectl apply -f pod
pod "nginx-1" configured
pod "nginx-2" configured
$ cd pod
$ mkdir subpod
$ ls
pod2.yaml  pod.yaml  subpod
$ mv * subpod/
$ ls
subpod
$ cd ..
$ kubectl apply -f pod  # everything is now in pod/subpod/*.yaml
error: you must provide one or more resources by argument or filename (.json|.yaml|.yml|stdin)
$

Expected behavior:

$ kubectl apply -f pod  # everything is now in pod/subpod/*.yaml
pod "nginx-1" configured
pod "nginx-2" configured
$
@ghodss ghodss changed the title kubectl apply should work recursively when given a directory kubectl apply should apply files recursively when given a directory Jan 17, 2016
@alex-mohr alex-mohr added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jan 21, 2016
@bgrant0607 bgrant0607 added priority/backlog Higher priority than priority/awaiting-more-evidence. area/app-lifecycle area/kubectl team/ux and removed sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Jan 22, 2016
@bgrant0607
Copy link
Member

We should do the same for all commands, not just apply. (That is, we should be consistent.)

cc @kubernetes/kubectl

@jackgr jackgr self-assigned this Jan 27, 2016
@bgrant0607
Copy link
Member

Since this isn't the current behavior, we'll need to make it optional via a flag.

@bgrant0607 bgrant0607 added this to the v1.2-candidate milestone Jan 27, 2016
@bgrant0607 bgrant0607 changed the title kubectl apply should apply files recursively when given a directory kubectl should process files recursively when given a directory Jan 29, 2016
@bgrant0607 bgrant0607 modified the milestones: v1.2, v1.2-candidate Jan 29, 2016
@bgrant0607 bgrant0607 modified the milestones: next-candidate, v1.2 Feb 8, 2016
k8s-github-robot pushed a commit that referenced this issue Mar 30, 2016
Automatic merge from submit-queue

allow kubectl cmds to process files recursively, when given a dir

This PR accomplishes two things:

1. It creates a `--recursive` flag for use with certain `kubectl` commands that _currently_ do not process files beyond their first level of children, as seen in the issue #19767
2. It enables the ability to use the `--recursive` flag in the `kubectl` commands that currently _only_ support processing a directory up to its first level of children.
@bgrant0607 bgrant0607 modified the milestones: v1.3, next-candidate Apr 28, 2016
@bgrant0607 bgrant0607 modified the milestones: next-candidate, v1.3 May 12, 2016
@metral
Copy link
Contributor

metral commented May 15, 2016

@bgrant0607
Copy link
Member

bgrant0607 commented May 18, 2016

@metral Thanks! Have you looked at #24649? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/app-lifecycle area/kubectl priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

5 participants