Environment Variables
Controller configuration is passed through the
postgresql-operator-controller-default-env ConfigMap. Both packagings
generate it — config/helm/templates/controller-default-env.yaml and
config/kustomize/base/controller-default-env.yaml — and both are
managed, so neither is the place to put your own variables.
Read a variable in cmd/controllers/<controller>/main.go with
utils.DefaultEnv("MY_VAR", "default"), then supply it from outside the
generated file. envFrom is last-wins, so anything mounted after the
generated ConfigMap overrides it — including generated keys such as
<PLURAL>_MAX_CONCURRENT_RECONCILES.
Helm — override a generated key with your own values file, and add
unknown variables through controllers.<name>.envFrom:
# my-values.yaml
global:
logLevel: debug
controllers:
database-controller:
envFrom:
- configMapRef:
name: my-settingshelm upgrade --install postgresql config/helm -f my-values.yamlKustomize — there is no values layer, so the manager mounts a second,
optional postgresql-operator-controller-env ConfigMap right after the
generated one. Create it in the operator’s namespace; the operator starts
without it.
kubectl create configmap postgresql-operator-controller-env \
-n postgresql-system \
--from-literal=MY_SETTING=value