1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
# kubernetes-split-yaml
[](https://actions-badge.atrox.dev/mogensen/kubernetes-split-yaml/goto?ref=master)
[](https://goreportcard.com/report/github.com/mogensen/kubernetes-split-yaml)
[](https://codecov.io/gh/mogensen/kubernetes-split-yaml)
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fmogensen%2Fkubernetes-split-yaml?ref=badge_shield)
Split the 'giant yaml file' into one file pr kubernetes resource
## Installation
If you have golang installed you can use `go get`.
```bash
$ go get -v github.com/mogensen/kubernetes-split-yaml
```
This will download the source and install the binary `kubernetes-split-yaml`
## Usage
* Simple invocation
```
$ kubernetes-split-yaml giant-k8s-file.yaml
```
* Modify / filter output filenames
```
# Note by default it'll output 0.2.0 non-hierical files
$ kubernetes-split-yaml --help
# Get namespaced hierarchy for output files
$ kubernetes-split-yaml --template_sel tpl_ns --outdir my-clustername/namespaces giant-k8s-file.yaml
# Ditto above, but only for Kubernetes objects starting with "myapp"
$ kubernetes-split-yaml --name_re ^myapp --template_sel tpl_ns --outdir my-clustername/namespaces giant-k8s-file.yaml
# Ditto above, but only for Deployments and StatefulSets
$ kubernetes-split-yaml --kind_re '^(StatefulSet|Deployment)' --name_re ^myapp --template_sel tpl_ns --outdir my-clustername/namespaces giant-k8s-file.yaml
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fmogensen%2Fkubernetes-split-yaml?ref=badge_large)
|