From 005359db1a37ba699498a1a9d647e8fc3ccbda91 Mon Sep 17 00:00:00 2001 From: Nam Hai Nguyen Date: Tue, 3 Oct 2023 10:33:19 +0000 Subject: [PATCH 1/2] Store and reference cloud API key in secret --- charts/opencost/templates/deployment.yaml | 5 ++++- charts/opencost/templates/secret.yaml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/charts/opencost/templates/deployment.yaml b/charts/opencost/templates/deployment.yaml index 807bce3..c427c9e 100644 --- a/charts/opencost/templates/deployment.yaml +++ b/charts/opencost/templates/deployment.yaml @@ -83,7 +83,10 @@ spec: value: {{ include "opencost.prometheusServerEndpoint" . | quote }} {{- if .Values.opencost.exporter.cloudProviderApiKey }} - name: CLOUD_PROVIDER_API_KEY - value: {{ .Values.opencost.exporter.cloudProviderApiKey | quote }} + valueFrom: + secretKeyRef: + name: {{ include "opencost.prometheus.secretname" . }} + key: CLOUD_PROVIDER_API_KEY {{- end }} - name: CLUSTER_ID value: {{ .Values.opencost.exporter.defaultClusterId | quote }} diff --git a/charts/opencost/templates/secret.yaml b/charts/opencost/templates/secret.yaml index 5abbf70..e451637 100644 --- a/charts/opencost/templates/secret.yaml +++ b/charts/opencost/templates/secret.yaml @@ -1,4 +1,4 @@ -{{- if or .Values.opencost.prometheus.username .Values.opencost.prometheus.password .Values.opencost.prometheus.bearer_token .Values.opencost.exporter.aws.access_key_id }} +{{- if or .Values.opencost.prometheus.username .Values.opencost.prometheus.password .Values.opencost.prometheus.bearer_token .Values.opencost.exporter.aws.access_key_id .Values.opencost.exporter.cloudProviderApiKey }} apiVersion: v1 kind: Secret metadata: @@ -23,4 +23,7 @@ data: {{- if .Values.opencost.exporter.aws.access_key_id }} AWS_SECRET_ACCESS_KEY: {{ .Values.opencost.exporter.aws.secret_access_key | b64enc | quote }} {{- end }} + {{- if .Values.opencost.exporter.cloudProviderApiKey }} + CLOUD_PROVIDER_API_KEY: {{ .Values.opencost.exporter.cloudProviderApiKey | b64enc | quote }} + {{- end }} {{- end }} From fc04cae4f17dee916f55d31c58ed401b4d67bc84 Mon Sep 17 00:00:00 2001 From: Matt Ray Date: Wed, 18 Oct 2023 22:01:33 +1100 Subject: [PATCH 2/2] Updated for latest release Signed-off-by: Matt Ray --- charts/opencost/Chart.yaml | 4 ++-- charts/opencost/README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/opencost/Chart.yaml b/charts/opencost/Chart.yaml index 80cc1c1..fa16c30 100755 --- a/charts/opencost/Chart.yaml +++ b/charts/opencost/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -appVersion: 1.106.1 +appVersion: 1.106.3 name: opencost description: OpenCost and OpenCost UI type: application @@ -9,7 +9,7 @@ keywords: - kubecost - opencost - monitoring -version: 1.20.0 +version: 1.21.0 maintainers: - name: mattray url: https://mattray.dev diff --git a/charts/opencost/README.md b/charts/opencost/README.md index 1d267de..9b4eeb4 100644 --- a/charts/opencost/README.md +++ b/charts/opencost/README.md @@ -2,9 +2,9 @@ OpenCost and OpenCost UI -![Version: 1.20.0](https://img.shields.io/badge/Version-1.20.0-informational?style=flat-square) +![Version: 1.21.0](https://img.shields.io/badge/Version-1.21.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) -![AppVersion: 1.106.1](https://img.shields.io/badge/AppVersion-1.106.1-informational?style=flat-square) +![AppVersion: 1.106.3](https://img.shields.io/badge/AppVersion-1.106.3-informational?style=flat-square) ## Maintainers