Closed SleepySquash closed 1 week ago
Allow tuning remote configuration per individual host in Helm chart (#1041, #954)
- add `conf-renderer` container and `template.sh` script generating YAML configuration per Ingress host
- support YAML format in `Config.init()` for remote configuration parsing
- use `try_files` for `/conf` Nginx route to return `$host` based configuration
Discussed: current solution creates separate init container for each domain, which is NOT the desired behaviour, as this may eventually break the Helm chart deployment with more and more domains being added (imagine 1000 init containers). Ideally we should have a single init container accepting the Values
context and then separating the different configurations for each domain, so that Helm doesn't embed a lot of stuff in the deployment resource.
Resolves #954
Synopsis
Helm should allow specifying different configuration for different domains.
Solution
This PR adds:
conf.toml
based on the$host
;.yaml
files based on the provided values.1) The
$host
based retrieval ofconf.toml
is the easy part-> nginx will try to get the
$host.toml
file first, and if fails to do so, then fallbacks toconf.toml
. E.g. if we arelocalhost
, then nginx will try to returnlocalhost.toml
instead ofconf.toml
by default.2) The Helm part is a bit harder. ~We need to cycle through
ingress.hosts
specified in the values and form a.toml
file for each host being a merge of the common.Values.conf
and a patch configuration for the provided host. I've managed to accomplish that by usinginitContainers
for every host. The containers use themergeOverwrite
Helm function to merge values. And then using the simpletoToml
I echo the merged values into theemptyDir
mount I then mount into theapp
container.~ See https://github.com/team113/messenger/pull/1041#discussion_r1644711821 for details.So, given the following
values.yaml
file:(notice the
empty
domain having no patch,localhost
domain adding thelegal
part and theexample.com
overwriting the ports)We get the following files: localhost.yaml
example.com.yaml
empty.yaml
Checklist
k::
labels applied