Merge pull request #4357 from natasha41575/TransformerAnnotations

define methods, types, and unit tests for transformer annotations
This commit is contained in:
Kubernetes Prow Robot
2022-01-10 15:32:28 -08:00
committed by GitHub
10 changed files with 428 additions and 15 deletions

View File

@@ -21,6 +21,13 @@ type Transformer interface {
Transform(m ResMap) error
}
// A TransformerWithProperties contains a Transformer and stores
// some of its properties
type TransformerWithProperties struct {
Transformer
Origin *resource.Origin
}
// A Generator creates an instance of ResMap.
type Generator interface {
Generate() (ResMap, error)
@@ -144,10 +151,24 @@ type ResMap interface {
AbsorbAll(ResMap) error
// AddOriginAnnotation will add the provided origin as
// an annotation to all resources in the Resmap, if
// an origin annotation to all resources in the ResMap, if
// the origin is not nil.
AddOriginAnnotation(origin *resource.Origin) error
// RemoveOriginAnnotation will remove the origin annotation
// from all resources in the ResMap
RemoveOriginAnnotations() error
// AddTransformerAnnotation will add the provided origin as
// an origin annotation if the resource doesn't have one; a
// transformer annotation otherwise; to all resources in
// ResMap
AddTransformerAnnotation(origin *resource.Origin) error
// RemoveTransformerAnnotation will remove the transformer annotation
// from all resources in the ResMap
RemoveTransformerAnnotations() error
// AnnotateAll annotates all resources in the ResMap with
// the provided key value pair.
AnnotateAll(key string, value string) error