add origin annotation for resources generated by generators (#4341)

* add origin annotation for resources generated by builtin and custom generators

* decouple origin data from generator data and account for inline generators
This commit is contained in:
Natasha Sarkar
2021-12-23 10:40:29 -08:00
committed by GitHub
parent 233f1a3c2a
commit 964bb38ba2
8 changed files with 717 additions and 21 deletions

View File

@@ -26,6 +26,13 @@ type Generator interface {
Generate() (ResMap, error)
}
// A GeneratorWithProperties contains a Generator and stores
// some of its properties
type GeneratorWithProperties struct {
Generator
Origin *resource.Origin
}
// Something that's configurable accepts an
// instance of PluginHelpers and a raw config
// object (YAML in []byte form).
@@ -136,6 +143,11 @@ type ResMap interface {
// self, then its behavior _cannot_ be merge or replace.
AbsorbAll(ResMap) error
// AddOriginAnnotation will add the provided origin as
// an annotation to all resources in the Resmap, if
// the origin is not nil.
AddOriginAnnotation(origin *resource.Origin) error
// AnnotateAll annotates all resources in the ResMap with
// the provided key value pair.
AnnotateAll(key string, value string) error