Open skandragon opened 5 months ago
@skandragon agreed the configuration should be split.
What you could try as a stop gap is using an init container with something like yq
to merge your configmap into the configuration.yaml
. Just make sure that you don't try to manage any yaml paths that are managed automatically by zigbee2mqtt.
See https://mikefarah.gitbook.io/yq/v/v2.x/merge#updating-files-in-place.
I would use kustomize with a configmap generator with a file input so you can write your static configuration in a real .yaml
file, and use an example zigbee2mqtt file to test.
Is your feature request related to a problem? Please describe
It's a problem I have, yes. :)
I want to run zigbee2mqtt in my Kubernetes cluster, using network-based Zigbee gateways. I have this working in Docker on an older PC already, but Kubernetes is where mqtt and most other things live now here at home.
Kubernetes (and best practices) tend to split hard-coded configuration from runtime configuration, and in Kubernetes this is doubly true.
It is more difficult to run zigbee2mqtt in Kubernetes because of this writable configuration file.
Describe the solution you'd like
I'd like some sort of split between
configuration.yaml
and perhapsruntime-configuration.yaml
or something. The idea is, the first file is used to bootstrap the second, or loaded in order so that the runtime will augment the former.Describe alternatives you've considered
In Kubernetes, a
Configmap
is a read-only file, and would be a perfect fit for the configuration.yaml file. However, as this is read-only, I cannot use it. ASecret
is also a good fit as there are some credentials in the yaml.What I will likely to is add some sort of script to the zigbee2mqtt startup which will look for a read-only config file, and copy it into the mounted read/write volume on startup, if there is no configuration already in that durable storage.
Additional context
This is also a "gitops" based model, which is common.