vectordotdev / helm-charts

Helm charts for Vector.
https://vector.dev
Mozilla Public License 2.0
106 stars 91 forks source link

Support `envFrom` to source extra env vars from a `ConfigMap` #210

Closed ktmq closed 1 year ago

ktmq commented 2 years ago

Allowing users to supply an existing configmap to source env vars from via envFrom is more flexible than env because it allows potential templating within the supplemental env vars.

One use case for this is configuring the enterprise section of vector config, which involves supplying sensitive values API and app keys. I did this using env vars, and added this to my templated configmap for vector.existingConfigMaps:

{{- if .Values.vector.ddObservabilityPipelinesEnabled }}
    enterprise:
      api_key: ${DATADOG_OBS_PIPELINE_API_KEY}
      application_key: ${DATADOG_OBS_PIPELINE_APP_KEY}
      configuration_key: ${DATADOG_OBS_PIPELINE_CONFIG_KEY}
{{- end }}

but since I can only define those env vars in env currently, they always have to be defined, regardless of whether .Values.vector.ddObservabilityPipelinesEnabled is true in my values.

Example using envFrom: https://github.com/DataDog/helm-charts/blob/main/charts/datadog/values.yaml#L311-L317

spencergilbert commented 1 year ago

I believe this is now supported thanks to https://github.com/vectordotdev/helm-charts/pull/246