influxdata / telegraf-operator

telegraf-operator helps monitor application on Kubernetes with Telegraf
Apache License 2.0
80 stars 37 forks source link

Support Default Environment Variables on Sidecar #127

Open jmickey opened 11 months ago

jmickey commented 11 months ago

It would be great if there was a way to support a default set of environment variables for sidecar containers.

For example, I would like to add namespace as a global tag, which require that the $NAMESPACE environment variable exists. Current the only way to support this is to ensure that every pod in the cluster is deployed with an telegraf.influxdata.com/env-fieldref-NAMESPACE: metadata.namespace annotation. If an application developer fails to include this then all their metrics are instead tagged with namespace = $NAMESPACE.

It would be great if there was a way to configure some default variables on a global level so that some global tags that require dynamic values like fieldref can be supported at a platform level rather than just hoping devs remember to add the right annotation.