1.1.0 • Published 4 years ago

k8s-yaml-filter v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

k8s-yaml-filter

Installation

npm i -g k8s-yaml-filter

usage

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:

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:

cat foo.yaml | k8sf -i metadata/namespace=kong,metadata/name=kong | kubectl apply -f -
1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago