After DolphinScheduler was deployed succeeded, I was thinking about how to inject the config data into the project. This document is for recording.
1. Docker
Docker mode’s file is here. The init shell is startup.sh and will init at #L81 config file. The config file is startup-init-conf.sh.
1. Config inject to docker
We can see a lot of config in the startup-init-conf.sh.
LikeDATABASE_HOST
and REGISTRY_SERVERS
and so on.
1 | docker run -d --name dolphinscheduler \ |
The docker run shell’s config will be injected.
2. Config inject to properties
We can see a lot of properties.tpl in /conf/dolphinscheduler. And all properties’s config is parameter name. And will be replaced by inject config at startup-init-conf.sh#L127.
The data flow is below:
2. Kubernetes
Kubernetes mode’s file is here. The config file is values.yaml. And will be injectd by _helper.tpl.
1. Change config in values.yaml
We can see a lot of config in the values.yaml.
LikeDATABASE_HOST
and REGISTRY_SERVERS
and so on.
2. helm install dolphinscheduler
Config inject to helm though _helper.tpl.
3. Config inject to k8s yaml
Helm inject the config though k8s yaml files.
4. Config inject to container’s environments
The pods will start, and we can see the container’s environments are our config values.
5. Docker container get’s the environments
The docker container is starting, and the inject is the same as docker data flow. Just one different thing is the config values are from the environments not the docker run shell.
The data flow is below: