https://github.com/latchmihay/k8s-yaml-splitter
Combined Kubernetes YAML Splitter
https://github.com/latchmihay/k8s-yaml-splitter
k8s k8s-yaml-splitter kubernetes kustomize split splitter yaml
Last synced: 6 months ago
JSON representation
Combined Kubernetes YAML Splitter
- Host: GitHub
- URL: https://github.com/latchmihay/k8s-yaml-splitter
- Owner: latchmihay
- License: gpl-2.0
- Created: 2018-11-17T23:32:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-11-22T19:35:37.000Z (over 4 years ago)
- Last Synced: 2024-06-20T16:46:04.691Z (about 2 years ago)
- Topics: k8s, k8s-yaml-splitter, kubernetes, kustomize, split, splitter, yaml
- Language: Go
- Size: 27.3 KB
- Stars: 13
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# k8s-yaml-splitter
It takes a combined kubernetes yaml config and splits it into multiple files in a folder of your choosing
# Install
```console
# Go 1.17+
go install github.com/latchmihay/k8s-yaml-splitter@latest
# everything before 1.17
go get github.com/latchmihay/k8s-yaml-splitter
```
# Usage
```console
Usage: ./k8s-yaml-splitter /path/to/combined-k8s.yaml /path/to/output/dir
Usage Dry Run: ./k8s-yaml-splitter /path/to/combined-k8s.yaml /path/to/output/dir -d
# Piped in
cat example/combined-k8s.yaml | ./k8s-yaml-splitter
```
# Example:
#### Dry Run:
```console
# ./k8s-yaml-splitter example/combined-k8s.yaml /tmp/k8s-split/ -d
Found! type: Secret | apiVersion: v1 | name: grafana | namespace: istio-system
==> DryRun: Writing /tmp/k8s-split/Secret-grafana.yaml
Found! type: Secret | apiVersion: v1 | name: kiali | namespace: istio-system
==> DryRun: Writing /tmp/k8s-split/Secret-kiali.yaml
Found! type: ConfigMap | apiVersion: v1 | name: istio-galley-configuration | namespace: istio-system
==> DryRun: Writing /tmp/k8s-split/ConfigMap-istio-galley-configuration.yaml
```
#### Normal Run:
```console
# ./k8s-yaml-splitter example/combined-k8s.yaml /tmp/k8s-split/
Found! type: Secret | apiVersion: v1 | name: grafana | namespace: istio-system
* Writing /tmp/k8s-split/Secret-grafana.yaml
* Wrote 250 bytes to /tmp/k8s-split/Secret-grafana.yaml
Found! type: Secret | apiVersion: v1 | name: kiali | namespace: istio-system
* Writing /tmp/k8s-split/Secret-kiali.yaml
* Wrote 242 bytes to /tmp/k8s-split/Secret-kiali.yaml
Found! type: ConfigMap | apiVersion: v1 | name: istio-galley-configuration | namespace: istio-system
* Writing /tmp/k8s-split/ConfigMap-istio-galley-configuration.yaml
* Wrote 3308 bytes to /tmp/k8s-split/ConfigMap-istio-galley-configuration.yaml
```
#### Piped in
> will create a `.k8s-global-obejcts` folder in your current directory and split the yamls in there
```console
# cat example/combined-k8s.yaml | ./k8s-yaml-splitter
Found! type: Secret | apiVersion: v1 | name: grafana | namespace: istio-system
* Writing /Users/madcricket/go/src/github.com/latchmihay/k8s-yaml-splitter/.k8s-yaml-splitter/Secret-grafana.yaml
* Wrote 250 bytes to /Users/madcricket/go/src/github.com/latchmihay/k8s-yaml-splitter/.k8s-yaml-splitter/Secret-grafana.yaml
Found! type: Secret | apiVersion: v1 | name: kiali | namespace: istio-system
* Writing /Users/madcricket/go/src/github.com/latchmihay/k8s-yaml-splitter/.k8s-yaml-splitter/Secret-kiali.yaml
* Wrote 242 bytes to /Users/madcricket/go/src/github.com/latchmihay/k8s-yaml-splitter/.k8s-yaml-splitter/Secret-kiali.yaml
Found! type: ConfigMap | apiVersion: v1 | name: istio-galley-configuration | namespace: istio-system
* Writing /Users/madcricket/go/src/github.com/latchmihay/k8s-yaml-splitter/.k8s-yaml-splitter/ConfigMap-istio-galley-configuration.yaml
* Wrote 3308 bytes to /Users/madcricket/go/src/github.com/latchmihay/k8s-yaml-splitter/.k8s-yaml-splitter/ConfigMap-istio-galley-configuration.yaml
```