https://github.com/eyolas/k8s-yaml-filter
Filter input YAML in Kubernetes format into output (stdin to stdout)
https://github.com/eyolas/k8s-yaml-filter
Last synced: 11 months ago
JSON representation
Filter input YAML in Kubernetes format into output (stdin to stdout)
- Host: GitHub
- URL: https://github.com/eyolas/k8s-yaml-filter
- Owner: eyolas
- Created: 2020-04-01T20:28:23.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-31T19:39:47.000Z (about 5 years ago)
- Last Synced: 2024-04-23T23:15:37.185Z (about 2 years ago)
- Language: JavaScript
- Size: 15.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# k8s-yaml-filter
### Installation
```sh
npm i -g k8s-yaml-filter
```
### usage
```sh
k8sf [-i type,type] [-o type,type]
```
Takes stdin, selects only objects in the 'in_filter', discards
objects in the 'out_filter', and writes the result to stdout.
The use case is with e.g. Kubernetes, you have a YAML file
which has CRD, webhook, and objects using these.
By default filter for kind
Apply the same YAML 3 times:
```sh
cat foo.yaml | k8sf -i CustomResourceDefinition | kubectl apply -f -
cat foo.yaml | k8sf -i ValidatingWebhookConfiguration | kubectl apply -f -
cat foo.yaml | kubectl apply -f -
```
on the last run you could choose
-o CustomResourceDefinition,ValidatingWebhookConfiguration
but its a bit moot since Kubernetes will properly apply the unchanged
CRD and WebHook
filter on other field:
```sh
cat foo.yaml | k8sf -i metadata/namespace=kong,metadata/name=kong | kubectl apply -f -
```