mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
Add TrackableFilter interface (#4410)
* add kio filter interface This interface is an extension of the Filter interface which can be used for filters which are capable of tracking which fields they mutate. * add TrackableSetter struct to filtersutil This struct provides an abstraction to help Filters implement the TrackableFilter interface * implement TrackableFilter with annotations This updates the annotations filter to implement the TrackableFilter interface by reusing the TrackableSetter abstraction provided by filtersutil. This is done to provide a generic and consistent experience across the filters * implement TrackableFilter with labels This updates the labels filter to implement the TrackableFilter interface by reusing the TrackableSetter abstraction provided by filtersutil. This is done to provide a generic and consistent experience across the filters
This commit is contained in:
@@ -57,6 +57,13 @@ type Filter interface {
|
||||
Filter([]*yaml.RNode) ([]*yaml.RNode, error)
|
||||
}
|
||||
|
||||
// TrackableFilter is an extension of Filter which is also capable of tracking
|
||||
// which fields were mutated by the filter.
|
||||
type TrackableFilter interface {
|
||||
Filter
|
||||
WithMutationTracker(func(key, value, tag string, node *yaml.RNode))
|
||||
}
|
||||
|
||||
// FilterFunc implements a Filter as a function.
|
||||
type FilterFunc func([]*yaml.RNode) ([]*yaml.RNode, error)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user