Configuration Patching in Kapitan with
Automatic Configuration Patching
kgenlib introduces a seamless way to auto-merge your configuration with default values using the
apply_patches decorator attribute. This is especially handy when you want certain base configurations to be consistently present, and then layer on more specific configurations as needed.
Example: Merging with Defaults
The following Python decorator showcases how you can employ the
In the above illustration:
apply_patchesattribute is supplied with a list that denotes the path to the default configurations.
- The defined generator, when invoked, would incorporate configurations from
generators.defaults.simple_fish_generatorseamlessly into its own.
Chaining Multiple Patches: If there's a need to merge configurations from multiple sources, just extend the list provided to
Variable Interpolation: For those situations where you require custom configurations,
kgenlibfacilitates variable interpolation. This means you can use variables in your configuration and have them be replaced with actual values during the generation process.