Refactor `template` and `inventory`
Summary
Related to: #20
Currently, a k8s object generating package (for example, the helper
or the RenderTemplates
task) depends on inventory
, which in turn depends on some global functions and state oftemplate
.
This design has some potential issues:
-
template
andinventory
are tightly coupled. As the code base grows, figuring out what depends on what will be harder. - The
template
global state is actually a hidden dependency forinventory
and other template rendering packages. It may cause some side effects. - Configuration code
template.Populate
ortemplate.RegisterFunctions
. They are making the packages harder to use correctly. - The
func (t *Template) Load() error
. It callsLoader.Load(t)
, which will call the template's method again. Unneeded Complexity.
Suggestion
Part 2 and 3 of the !36 contains an idea of refactoring.
Success criteria
-
TBD
Edited by Lucas Li