Skip to content

Commit 3f65a6f

Browse files
authored
Merge pull request #307 from gracedo/gracedo/clusterid_cm
feat: Add option to use cm to set CLUSTER_ID envvar
2 parents d78775b + c43f29e commit 3f65a6f

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

charts/opencost/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ keywords:
99
- finops
1010
- monitoring
1111
- opencost
12-
version: 2.3.0
12+
version: 2.3.1
1313
maintainers:
1414
- name: jessegoodier
1515
- name: toscott

charts/opencost/templates/deployment.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,17 @@ spec:
198198
name: {{ include "opencost.prometheus.secretname" . }}
199199
key: CLOUD_PROVIDER_API_KEY
200200
{{- end }}
201+
{{- if and (.Values.opencost.exporter.defaultClusterId) (not .Values.opencost.exporter.clusterIdConfigmap) }}
201202
- name: CLUSTER_ID
202203
value: {{ .Values.opencost.exporter.defaultClusterId | quote }}
204+
{{- end }}
205+
{{- if .Values.opencost.exporter.clusterIdConfigmap }}
206+
- name: CLUSTER_ID
207+
valueFrom:
208+
configMapKeyRef:
209+
name: {{ .Values.opencost.exporter.clusterIdConfigmap }}
210+
key: CLUSTER_ID
211+
{{- end }}
203212
{{- if .Values.opencost.exporter.aws.access_key_id }}
204213
- name: AWS_ACCESS_KEY_ID
205214
valueFrom:

charts/opencost/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ opencost:
136136
cloudProviderApiKey: ""
137137
# -- Default cluster ID to use if cluster_id is not set in Prometheus metrics.
138138
defaultClusterId: 'default-cluster'
139+
# -- If clusterIdConfigmap is defined, use user-generated ConfigMap with key CLUSTER_ID as default cluster ID.
140+
# -- This overrides the above defaultClusterId. Ensure the ConfigMap exists and contains the required CLUSTER_ID key.
141+
# clusterIdConfigmap: cluster-id-configmap
139142
image:
140143
# -- Exporter container image registry
141144
registry: ghcr.io

0 commit comments

Comments
 (0)