rancher-partner-charts/charts/kubecost/cost-analyzer/templates/grafana-datasource-template...

39 lines
1.1 KiB
YAML

{{- if .Values.grafana -}}
{{- if .Values.grafana.sidecar -}}
{{- if .Values.grafana.sidecar.datasources -}}
{{- if .Values.grafana.sidecar.datasources.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-datasource
{{- if $.Values.grafana.namespace_datasources }}
namespace: {{ $.Values.grafana.namespace_datasources }}
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.datasources.label }}
{{ $.Values.grafana.sidecar.datasources.label }}: "1"
{{- else }}
{{- if .Values.global.grafana.enabled }}
kubecost_grafana_datasource: "1"
{{- else }}
grafana_datasource: "1"
{{- end }}
{{- end }}
data:
{{ default "datasource.yaml" .Values.grafana.sidecar.datasources.dataSourceFilename }}: |-
apiVersion: 1
datasources:
- access: proxy
name: default-kubecost
type: prometheus
{{- if .Values.grafana.sidecar.datasources.defaultDatasourceEnabled }}
isDefault: true
{{- else }}
isDefault: false
{{- end }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}