k8s-yaml-filter
Filter input YAML in Kubernetes format into output (stdin to stdout)
Last updated 2 months ago by eyolas .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install k8s-yaml-filter 
SYNC missed versions from official npm registry.

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 -

Current Tags

  • 1.1.0                                ...           latest (2 months ago)

3 Versions

  • 1.1.0                                ...           2 months ago
  • 1.0.1                                ...           2 months ago
  • 1.0.0                                ...           2 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 29
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |