Skip to content

Commit

Permalink
Provider related custom pricing config file name (#144)
Browse files Browse the repository at this point in the history
* Provider related custom pricing config file name

RESOLVES: #129

* Bump version

---------

Co-authored-by: Moritz Rieger <[email protected]>
Co-authored-by: Tony Scott <[email protected]>
  • Loading branch information
3 people authored Nov 11, 2023
1 parent 7e1acea commit 19f72a5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/opencost/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ keywords:
- kubecost
- opencost
- monitoring
version: 1.26.1
version: 1.26.2
maintainers:
- name: mattray
url: https://mattray.dev
Expand Down
11 changes: 11 additions & 0 deletions charts/opencost/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,14 @@ Check that the config is valid
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Define opencost config file name
*/}}
{{- define "opencost.configFileName" -}}
{{- if eq .Values.opencost.customPricing.provider "custom" -}}
{{- print "default" -}}
{{- else -}}
{{- .Values.opencost.customPricing.provider -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/opencost/templates/configmap-custom-pricing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: ConfigMap
metadata:
name: {{ .Values.opencost.customPricing.configmapName }}
data:
default.json: |-
{{ include "opencost.configFileName" . }}.json: |-
{
{{- range $key, $val := .Values.opencost.customPricing.costModel }}
{{ $key | quote | indent 6}}: {{ $val | quote }},
Expand Down

0 comments on commit 19f72a5

Please sign in to comment.