kyaml: rename annotations and fix linting

This commit is contained in:
Phillip Wittrock
2019-11-07 11:46:42 -08:00
parent e0b46acf2f
commit 3db1111f8e
22 changed files with 242 additions and 223 deletions

View File

@@ -37,6 +37,12 @@ func (fn WriterFunc) Write(o []*yaml.RNode) error {
return fn(o)
}
// ReaderWriter implements both Reader and Writer interfaces
type ReaderWriter interface {
Reader
Writer
}
// Filter modifies a collection of Resource Configuration by returning the modified slice.
// When possible, Filters should be serializable to yaml so that they can be described
// as either data or code.
@@ -106,3 +112,16 @@ func (p Pipeline) Execute() error {
}
return nil
}
// FilterAll runs the yaml.Filter against all inputs
func FilterAll(filter yaml.Filter) Filter {
return FilterFunc(func(nodes []*yaml.RNode) ([]*yaml.RNode, error) {
for i := range nodes {
_, err := filter.Filter(nodes[i])
if err != nil {
return nil, err
}
}
return nodes, nil
})
}