Refactor kustomize config command structure

- Create cfg, fn, live parent commands
This commit is contained in:
Phillip Wittrock
2020-06-03 13:17:30 -07:00
committed by Phillip Wittrock
parent 73157c7141
commit 701c217791
68 changed files with 669 additions and 3846 deletions

View File

@@ -6,7 +6,7 @@
[Alpha] Display Resource structure from a directory or stdin.
kustomize config tree may be used to print Resources in a directory or cluster, preserving structure
kustomize cfg tree may be used to print Resources in a directory or cluster, preserving structure
Args:
@@ -15,38 +15,38 @@ Args:
Resource fields may be printed as part of the Resources by specifying the fields as flags.
kustomize config tree has build-in support for printing common fields, such as replicas, container images,
kustomize cfg tree has build-in support for printing common fields, such as replicas, container images,
container names, etc.
kustomize config tree supports printing arbitrary fields using the '--field' flag.
kustomize cfg tree supports printing arbitrary fields using the '--field' flag.
By default, kustomize config tree uses Resource graph structure if any relationships between resources (ownerReferences)
By default, kustomize cfg tree uses Resource graph structure if any relationships between resources (ownerReferences)
are detected, as is typically the case when printing from a cluster. Otherwise, directory graph structure is used. The
graph structure can also be selected explicitly using the '--graph-structure' flag.
### Examples
# print Resources using directory structure
kustomize config tree my-dir/
kustomize cfg tree my-dir/
# print replicas, container name, and container image and fields for Resources
kustomize config tree my-dir --replicas --image --name
kustomize cfg tree my-dir --replicas --image --name
# print all common Resource fields
kustomize config tree my-dir/ --all
kustomize cfg tree my-dir/ --all
# print the "foo"" annotation
kustomize config tree my-dir/ --field "metadata.annotations.foo"
kustomize cfg tree my-dir/ --field "metadata.annotations.foo"
# print the "foo"" annotation
kubectl get all -o yaml | kustomize config tree \
kubectl get all -o yaml | kustomize cfg tree \
--field="status.conditions[type=Completed].status"
# print live Resources from a cluster using owners for graph structure
kubectl get all -o yaml | kustomize config tree --replicas --name --image
kubectl get all -o yaml | kustomize cfg tree --replicas --name --image
# print live Resources with status condition fields
kubectl get all -o yaml | kustomize config tree \
kubectl get all -o yaml | kustomize cfg tree \
--name --image --replicas \
--field="status.conditions[type=Completed].status" \
--field="status.conditions[type=Complete].status" \