Skip to content

Commit

Permalink
Merge pull request #787 from kubecost/sean/datasource-helmchart
Browse files Browse the repository at this point in the history
Update grafana-datasource-template
  • Loading branch information
Sean Holcomb authored Mar 8, 2021
2 parents de88df6 + 1a3f2b0 commit 27a4a72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 29 deletions.
40 changes: 12 additions & 28 deletions cost-analyzer/templates/grafana-datasource-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
namespace: {{ $.Values.grafana.namespace_datasources }}
{{- end }}
labels:
{{ include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.datasources.label }}
{{ $.Values.grafana.sidecar.datasources.label }}: "1"
{{- else }}
Expand All @@ -25,45 +25,29 @@ data:
apiVersion: 1
datasources:
- access: proxy
{{- if .Values.global.thanos }}
{{- if .Values.global.thanos.enabled }}
name: {{ default "Prometheus" .Values.grafana.sidecar.datasources.dataSourceName }}
isDefault: false
{{- else }}
name: "default-kubecost"
{{- if .Values.grafana.sidecar.datasources.defaultDatasourceEnabled }}
isDefault: true
{{- else }}
isDefault: false
{{- end }}
{{- end }}
{{- else }}
name: "default-kubecost"
name: default-kubecost
type: prometheus
{{- if .Values.grafana.sidecar.datasources.defaultDatasourceEnabled }}
isDefault: true
{{- else }}
isDefault: false
{{- end }}
{{- end }}
type: prometheus
{{- if .Values.global.thanos }}
{{- if .Values.global.thanos.enabled }}
{{- if .Values.global.prometheus.enabled }}
url: http://{{ template "cost-analyzer.prometheus.server.name" . }}.{{ .Release.Namespace }}
url: http://{{ .Release.Name }}-thanos-query-http.{{ .Release.Namespace }}:{{ .Values.thanos.query.http.port }}
{{- else }}
url: {{ .Values.global.prometheus.fqdn }}
url: {{ .Values.global.thanos.queryService }}
{{- end }}
{{- if .Values.global.thanos.enabled }}
- access: proxy
name: "default-kubecost"
type: prometheus
{{- if .Values.grafana.sidecar.datasources.defaultDatasourceEnabled }}
isDefault: true
{{- else }}
name: {{ default "Prometheus" .Values.grafana.sidecar.datasources.dataSourceName}}
isDefault: false
type: prometheus
{{- end }}
{{- if .Values.global.prometheus.enabled }}
url: http://{{ .Release.Name }}-thanos-query-http.{{ .Release.Namespace }}:{{ .Values.thanos.query.http.port }}
{{ else }}
url: {{ .Values.global.thanos.queryService }}
url: http://{{ template "cost-analyzer.prometheus.server.name" . }}.{{ .Release.Namespace }}
{{- else }}
url: {{ .Values.global.prometheus.fqdn }}
{{- end }}
{{- end }}
{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion cost-analyzer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ grafana:
# dataSourceFilename: foo.yml # If you need to change the name of the datasource file
enabled: true
defaultDatasourceEnabled: false
dataSourceName: default-kubecost
dataSourceName: prometheus-kubecost
# label that the configmaps with datasources are marked with
label: kubecost_grafana_datasource
# For grafana to be accessible, add the path to root_url. For example, if you run kubecost at www.foo.com:9090/kubecost
Expand Down

0 comments on commit 27a4a72

Please sign in to comment.