Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update grafana-datasource-template #787

Merged
merged 10 commits into from
Mar 8, 2021
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
6 changes: 3 additions & 3 deletions cost-analyzer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,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 All @@ -534,7 +534,7 @@ serviceAccount:
# These configs can also be set from the Settings page in the Kubecost product UI
# Values in this block override config changes in the Settings UI on pod restart
#
#kubecostProductConfigs:
kubecostProductConfigs:
Sean-Holcomb marked this conversation as resolved.
Show resolved Hide resolved
# An optional list of cluster definitions that can be added for frontend access. The local
# cluster is *always* included by default, so this list is for non-local clusters.
# Ref: https://github.com/kubecost/docs/blob/master/multi-cluster.md
Expand Down Expand Up @@ -617,7 +617,7 @@ serviceAccount:
# azureStorageAccount: "kubecoststore" # Name of Azure Storage account where cost report is being saved
# azureStorageAccessKey: "" # Azure Storage account access key found in Azure Storage portal for account where cost report is being saved
# azureStorageContainer: "test" # Name of daily month-to-date cost report for Azure
# azureStorageSecretName: "azure-storage-config" # Name of Kubernetes Secret where Azure Storage Configuration is stored
azureStorageSecretName: "azure-storage-config" # Name of Kubernetes Secret where Azure Storage Configuration is stored
Sean-Holcomb marked this conversation as resolved.
Show resolved Hide resolved
# azureStorageCreateSecret: true # Create secret for Azure Storage config from values in this file
# discount: "" # percentage discount applied to compute
# negotiatedDiscount: "" # custom negotiated cloud provider discount
Expand Down