Skip to content

Commit de71167

Browse files
tomilhoopenshift-merge-bot[bot]
authored andcommitted
add GetUsedUnstructs()
Signed-off-by: Tomas Silva <136352470+tomilho@users.noreply.github.com>
1 parent 0173ab8 commit de71167

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/templates/templates.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,16 @@ func (t *TemplateResolver) GetUsedResources() []UsedResource {
10471047
return t.usedResources
10481048
}
10491049

1050+
// returns a slice of the unstructured resources collected in usedResources
1051+
func (t *TemplateResolver) GetUsedUnstructs() []unstructured.Unstructured {
1052+
objs := make([]unstructured.Unstructured, 0, len(t.usedResources))
1053+
for _, used := range t.usedResources {
1054+
objs = append(objs, used.Resource)
1055+
}
1056+
1057+
return objs
1058+
}
1059+
10501060
// applyContextTransformers runs the configured ContextTransformers in order and
10511061
// returns the final transformed context. This is only called when a
10521062
// DynamicWatcher is configured.

0 commit comments

Comments
 (0)