Debian Codegraph @

cmd/config/docs/commands/fmt.md

raw symbols SCIP
1 ## fmt
2
3 [Alpha] Format yaml configuration files.
4
5 ### Synopsis
6
7 [Alpha] Format yaml configuration files.
8
9 Fmt will format input by ordering fields and unordered list items in Kubernetes
10 objects. Inputs may be directories, files or stdin, and their contents must
11 include both apiVersion and kind fields.
12
13 - Stdin inputs are formatted and written to stdout
14 - File inputs (args) are formatted and written back to the file
15 - Directory inputs (args) are walked, each encountered .yaml and .yml file
16 acts as an input
17
18 For inputs which contain multiple yaml documents separated by \n---\n,
19 each document will be formatted and written back to the file in the original
20 order.
21
22 Field ordering roughly follows the ordering defined in the source Kubernetes
23 resource definitions (i.e. go structures), falling back on lexicographical
24 sorting for unrecognized fields.
25
26 Unordered list item ordering is defined for specific Resource types and
27 field paths.
28
29 - .spec.template.spec.containers (by element name)
30 - .webhooks.rules.operations (by element value)
31
32 ### Examples
33
34 # format file1.yaml and file2.yml
35 kustomize cfg fmt file1.yaml file2.yml
36
37 # format all *.yaml and *.yml recursively traversing directories
38 kustomize cfg fmt my-dir/
39
40 # format kubectl output
41 kubectl get -o yaml deployments | kustomize cfg fmt
42
43 # format kustomize output
44 kustomize build | kustomize cfg fmt