| 1 | ## grep |
| 2 | |
| 3 | [Alpha] Search for matching Resources in a directory or from stdin |
| 4 | |
| 5 | ### Synopsis |
| 6 | |
| 7 | [Alpha] Search for matching Resources in a directory or from stdin. |
| 8 | |
| 9 | QUERY: |
| 10 | Query to match expressed as 'path.to.field=value'. |
| 11 | Maps and fields are matched as '.field-name' or '.map-key' |
| 12 | List elements are matched as '[list-elem-field=field-value]' |
| 13 | The value to match is expressed as '=value' |
| 14 | '.' as part of a key or value can be escaped as '\.' |
| 15 | |
| 16 | DIR: |
| 17 | Path to local directory. |
| 18 | |
| 19 | ### Examples |
| 20 | |
| 21 | # find Deployment Resources |
| 22 | kustomize cfg grep "kind=Deployment" my-dir/ |
| 23 | |
| 24 | # find Resources named nginx |
| 25 | kustomize cfg grep "metadata.name=nginx" my-dir/ |
| 26 | |
| 27 | # use tree to display matching Resources |
| 28 | kustomize cfg grep "metadata.name=nginx" my-dir/ | kustomize cfg tree |
| 29 | |
| 30 | # look for Resources matching a specific container image |
| 31 | kustomize cfg grep "spec.template.spec.containers[name=nginx].image=nginx:1\.7\.9" my-dir/ | kustomize cfg tree |