Pydantic is a great tool all around and can be used to load and validate app settings.
The problem is, that this usually results in a lot of environment variables having to be set,
which is suboptimal for kubernetes deployments. See a typical example in this configuration module pydantic_settings_version.py.
Instead we usually want to mount our configurations as secrets and configmaps and merge them all together:
configuration.yamlsecret.yaml
Unfortunately, pydantic does not offer the same partial-merging
capabilities as the config crate in Rust (see settings.rs) out of the box
and we would have to implement this ourselves,
which is a bit overcomplicating things if we also want to have final override-capabilities using environment variables.
Instead, we can use this easy workaround shown in pydantic_dynaconf_version.py using dynaconf, which lets us lazily merge our partial sources in the order
we specify, which we can then directly pass to pydantic, thus giving us all the flexibility we want.