github.com/keikoproj/manny@v0.0.0-20210726112440-8571e4c99ced/docs/config.md (about) 1 # Configuration 2 3 Manny's `build` subcommand is a wrapper around `Configurator`. Configurators job does all the business logic for Manny. 4 First base configurations are loaded, followed by stacks, and finally a deployment manifest is output. 5 6 ### Bases 7 8 Bases are the first thing that are loaded, their data structure can be 9 [found here](https://github.com/keikoproj/manny/blob/master/configurator/configurator.go#L113-L138). Manny 10 configs can inherit from eachother using a field called "Base", which is how base configs got their name. 11 12 #### Configuration Inheritance Example 13 14 Given the following directory structure: 15 16 usw2 17 ├── config.yaml 18 ├── vpc1 19 │ ├── config.yaml 20 │ └── privatelink 21 │ └── config.yaml 22 └── vpc2 23 ├── config.yaml 24 └── privatelink 25 └── config.yaml 26 27 Given that: 28 - `usw2/vpc1/privatelink/config.yaml` has a `base` field of `../config.yaml` and a `test` field of `test` 29 - `usw2/vpc1/config.yaml` has a `base` field of `../config.yaml` and a `test` field of `test-2` 30 - `usw2/config.yaml` has a `test` field of `test-3` 31 - The user performs: `manny build usw2/vpc1/privatelink` 32 33 Manny will: 34 1. Get a list of files in `usw2/vpc1/privatelink/` and find `config.yaml`. 35 2. Reach `config.yaml` and extract the base. When a base is found Manny will pause unmarshalling data and will read the 36 next base. 37 3. Read `usw2/vpc1/config.yaml` and discover another base, pausing unmarshalling as it did before. 38 4. Read `usw2/config.yaml` 39 5. After unmarshal it goes back to the previous config, creates a `MannyConfig`, and stores that struct in a `slice` 40 6. After all `MannyConfig` objects have been stored in `Configurator.Bases` Manny will apply each `MannyConfig` in 41 `Configurator.Bases` to `Configurator.Global` from first to last index 42 43 This process gives us a trail to audit failures and is still quite fast given that empty structs do not occupy memory. 44 That said, this process can be improved. 45 46 #### Picking up additional deployments 47 48 Manny is capable of discovering higher level deployments. Assuming the same structure as above, and an input of 49 `manny build usw2/vpc1` Manny would discover the `privatelink` directory and then create a second deployment that is 50 entirely separated from the first. 51 52 Manny does this while evaluating files and directories in a provided directory. It then creates a new `Configurator` 53 instance and calls `loadBases()` and `loadStacks()`. The deployments are then added to the parent `Configurator.Stacks`.