From a2b63b2343b6700bdb4cdd16d37197b1411a6233 Mon Sep 17 00:00:00 2001 From: ahauser Date: Fri, 7 Aug 2026 15:48:43 +0200 Subject: [PATCH] Add opencost.exporter.extraEnvFrom for envFrom sources The exporter container renders extraEnv as literal name/value pairs only, so an env var whose value is not known when the values file is written cannot be supplied. clusterIdConfigmap already works around this for CLUSTER_ID specifically; generalise that escape hatch by rendering an envFrom list from the new opencost.exporter.extraEnvFrom value, letting any exporter env var come from a ConfigMap or Secret. Value name and rendering follow the convention used by the promtail and loki charts. The envFrom block sits after env: to keep precedence semantics obvious; explicit env entries win over envFrom in Kubernetes regardless of order. Only the exporter is changed: ui.extraEnv and sigV4Proxy.extraEnv are list-shaped and already accept valueFrom. The README table row and version badge are updated in place; a full helm-docs run also picks up unrelated drift from the v1.121.1 release and is left to the publish workflow. Signed-off-by: ahauser --- charts/opencost/Chart.yaml | 2 +- charts/opencost/README.md | 3 ++- charts/opencost/templates/deployment.yaml | 4 ++++ charts/opencost/values.yaml | 6 ++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/charts/opencost/Chart.yaml b/charts/opencost/Chart.yaml index 0b87dc1..d2ad7be 100755 --- a/charts/opencost/Chart.yaml +++ b/charts/opencost/Chart.yaml @@ -9,7 +9,7 @@ keywords: - finops - monitoring - opencost -version: 2.5.29 +version: 2.5.30 maintainers: - name: jessegoodier - name: toscott diff --git a/charts/opencost/README.md b/charts/opencost/README.md index 5d8700d..4dc1305 100644 --- a/charts/opencost/README.md +++ b/charts/opencost/README.md @@ -2,7 +2,7 @@ OpenCost and OpenCost UI -![Version: 2.5.28](https://img.shields.io/badge/Version-2.5.28-informational?style=flat-square) +![Version: 2.5.30](https://img.shields.io/badge/Version-2.5.30-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.121.0](https://img.shields.io/badge/AppVersion-1.121.0-informational?style=flat-square) [![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/opencost)](https://artifacthub.io/packages/search?repo=opencost) @@ -92,6 +92,7 @@ $ helm install opencost opencost/opencost | opencost.exporter.env | list | `[]` | List of additional environment variables to set in the container | | opencost.exporter.extraArgs | list | `[]` | List of extra arguments for the command, e.g.: log-format=json | | opencost.exporter.extraEnv | object | `{}` | Any extra environment variables you would like to pass on to the pod | +| opencost.exporter.extraEnvFrom | list | `[]` | Extra environment variables from secrets or configmaps | | opencost.exporter.extraVolumeMounts | list | `[]` | A list of volume mounts to be added to the pod | | opencost.exporter.image | object | `{"fullImageName":null,"pullPolicy":"IfNotPresent","registry":"ghcr.io","repository":"opencost/opencost","tag":"1.121.0@sha256:2b0def286f343891b2cb2f10309d92bd614aab2f886e363cdc817dfd8595e472"}` | Exporter container image configuration | | opencost.exporter.image.fullImageName | string | `nil` | Override the full image name for development purposes | diff --git a/charts/opencost/templates/deployment.yaml b/charts/opencost/templates/deployment.yaml index 76b417f..b320576 100644 --- a/charts/opencost/templates/deployment.yaml +++ b/charts/opencost/templates/deployment.yaml @@ -376,6 +376,10 @@ spec: - name: MCP_SERVER_ENABLED value: "false" {{- end }} + {{- with .Values.opencost.exporter.extraEnvFrom }} + envFrom: + {{- toYaml . | nindent 12 }} + {{- end }} {{- if or .Values.plugins.enabled .Values.opencost.exporter.persistence.enabled .Values.opencost.exporter.extraVolumeMounts .Values.opencost.customPricing.enabled .Values.opencost.metrics.config.enabled $cloudIntegrationSecretName .Values.opencost.updateCaTrust.enabled}} volumeMounts: {{- if .Values.plugins.enabled }} diff --git a/charts/opencost/values.yaml b/charts/opencost/values.yaml index fae4c06..1d1c8e5 100644 --- a/charts/opencost/values.yaml +++ b/charts/opencost/values.yaml @@ -444,6 +444,12 @@ opencost: # FOO: BAR # For example, if accessing mimir directly and getting 401 Unauthorized # PROMETHEUS_HEADER_X_SCOPE_ORGID: anonymous + # -- Extra environment variables from secrets or configmaps + extraEnvFrom: [] + # - configMapRef: + # name: opencost-env + # - secretRef: + # name: opencost-env-secret # Admin token for write operations (e.g. POST /serviceKey, cloud config endpoints). # Set ADMIN_TOKEN env from a chart-created secret or an existing secret. adminToken: