Documentation
¶
Overview ¶
Package generators contains all codes about the Spec generator mechanism. It is a feature about kusion that can make Kusion more general in generating Spec and decoupled with KCLVM. Any generator implements the generator interface can be integrated in Kusion operation workflow.
This mechanism is very meaningful to Kusion and makes the foundation to support other languages in the feature.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendToSpec ¶
AppendToSpec adds a Kubernetes resource to the Spec resources slice.
func CallGenerators ¶
func CallGenerators(i *v1.Spec, newGenerators ...NewSpecGeneratorFunc) error
CallGenerators calls the Generate method of each SpecGenerator instance returned by the given NewSpecGeneratorFuncs.
Types ¶
type NewSpecGeneratorFunc ¶
type NewSpecGeneratorFunc func() (SpecGenerator, error)
NewSpecGeneratorFunc is a function that returns a SpecGenerator.
type SpecGenerator ¶
type SpecGenerator interface {
// Generate performs the intent generate operation.
Generate(intent *v1.Spec) error
}
SpecGenerator is an interface for things that can generate Spec from input configurations. Note: it's for built-in generators to produce Spec, which is not the same as the general Module interface.
func CallGeneratorFuncs ¶
func CallGeneratorFuncs(newGenerators ...NewSpecGeneratorFunc) ([]SpecGenerator, error)
CallGeneratorFuncs calls each NewSpecGeneratorFunc in the given slice and returns a slice of SpecGenerator instances.