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

grafana updates + remove kiwigrid sidecar #3638

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
.gopath
.dist
.manifest
.kubeconfig
gke_gcloud_auth_plugin_cache
2 changes: 1 addition & 1 deletion cost-analyzer/templates/grafana-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metadata:
{{ toYaml . | indent 4 }}
{{- end }}
name: {{ template "grafana.fullname" . }}-clusterrole
{{- if or .Values.grafana.sidecar.dashboards.enabled .Values.grafana.sidecar.datasources.enabled }}
{{- if or (.Values.grafana.sidecar).dashboards.enabled (.Values.grafana.sidecar).datasources.enabled }}
rules:
- apiGroups: [""] # "" indicates the core API group
resources: ["configmaps"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if (eq (include "cost-analyzer.grafanaEnabled" .) "true") }}
{{- if .Values.grafana.sidecar.dashboards.enabled }}
{{- if (.Values.grafana.sidecar).dashboards.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -23,6 +23,6 @@ data:
type: file
disableDeletion: false
options:
path: {{ .Values.grafana.sidecar.dashboards.folder }}
path: {{ (.Values.grafana.sidecar).dashboards.folder }}
{{- end}}
{{ end }}
21 changes: 21 additions & 0 deletions cost-analyzer/templates/grafana-dashboards.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if ((.Values.grafana).dashboards).enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboard-attached-disk-metrics
{{- if $.Values.grafana.namespace_dashboards }}
namespace: {{ $.Values.grafana.namespace_dashboards }}
{{- end }}
labels:
{{ include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if ((.Values.grafana).dashboards).label }}
{{ ((.Values.grafana).dashboards).label }}: "{{ ((.Values.grafana).dashboards).labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
data:
attached-disks.json: |-
{{- .Files.Get "grafana-dashboards/attached-disks.json" | nindent 4 }}
{{- end -}}
38 changes: 19 additions & 19 deletions cost-analyzer/templates/grafana-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,46 +88,46 @@ spec:
{{- end}}
{{- end }}
containers:
{{- if .Values.grafana.sidecar.dashboards.enabled }}
{{- if (.Values.grafana.sidecar).dashboards.enabled }}
- name: {{ template "grafana.name" . }}-sc-dashboard
image: "{{ .Values.grafana.sidecar.image.repository }}:{{ .Values.grafana.sidecar.image.tag }}"
imagePullPolicy: {{ .Values.grafana.sidecar.image.pullPolicy }}
image: "{{ ((.Values.grafana).sidecar).image.repository }}:{{ ((.Values.grafana).sidecar).image.tag }}"
imagePullPolicy: {{ ((.Values.grafana).sidecar).image.pullPolicy }}
{{- if .Values.global.containerSecurityContext }}
securityContext:
{{- toYaml .Values.global.containerSecurityContext | nindent 12 -}}
{{- end }}
env:
- name: LABEL
value: "{{ .Values.grafana.sidecar.dashboards.label }}"
value: "{{ ((.Values.grafana).sidecar).dashboards.label }}"
- name: FOLDER
value: "{{ .Values.grafana.sidecar.dashboards.folder }}"
value: "{{ ((.Values.grafana).sidecar).dashboards.folder }}"
- name: ERROR_THROTTLE_SLEEP
value: "{{ .Values.grafana.sidecar.dashboards.error_throttle_sleep }}"
{{- with .Values.grafana.sidecar.resources }}
value: "{{ ((.Values.grafana).sidecar).dashboards.error_throttle_sleep }}"
{{- with ((.Values.grafana).sidecar).resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: sc-dashboard-volume
mountPath: {{ .Values.grafana.sidecar.dashboards.folder | quote }}
mountPath: {{ ((.Values.grafana).sidecar).dashboards.folder | quote }}
{{- end}}
{{- if .Values.grafana.sidecar.datasources.enabled }}
{{- if ((.Values.grafana).sidecar).datasources.enabled }}
- name: {{ template "grafana.name" . }}-sc-datasources
image: "{{ .Values.grafana.sidecar.image.repository }}:{{ .Values.grafana.sidecar.image.tag }}"
imagePullPolicy: {{ .Values.grafana.sidecar.image.pullPolicy }}
image: "{{ ((.Values.grafana).sidecar).image.repository }}:{{ ((.Values.grafana).sidecar).image.tag }}"
imagePullPolicy: {{ ((.Values.grafana).sidecar).image.pullPolicy }}
{{- with .Values.global.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
env:
- name: LABEL
value: "{{ .Values.grafana.sidecar.datasources.label }}"
value: "{{ ((.Values.grafana).sidecar).datasources.label }}"
- name: FOLDER
value: "/etc/grafana/provisioning/datasources"
- name: ERROR_THROTTLE_SLEEP
value: "{{ .Values.grafana.sidecar.datasources.error_throttle_sleep }}"
value: "{{ ((.Values.grafana).sidecar).datasources.error_throttle_sleep }}"
resources:
{{ toYaml .Values.grafana.sidecar.resources | indent 12 }}
{{ toYaml ((.Values.grafana).sidecar).resources | indent 12 }}
volumeMounts:
- name: sc-datasources-volume
mountPath: "/etc/grafana/provisioning/datasources"
Expand Down Expand Up @@ -173,14 +173,14 @@ spec:
mountPath: "/etc/grafana/provisioning/dashboards/dashboardproviders.yaml"
subPath: dashboardproviders.yaml
{{- end }}
{{- if .Values.grafana.sidecar.dashboards.enabled }}
{{- if ((.Values.grafana).sidecar).dashboards.enabled }}
- name: sc-dashboard-volume
mountPath: {{ .Values.grafana.sidecar.dashboards.folder | quote }}
mountPath: {{ ((.Values.grafana).sidecar).dashboards.folder | quote }}
- name: sc-dashboard-provider
mountPath: "/etc/grafana/provisioning/dashboards/sc-dashboardproviders.yaml"
subPath: provider.yaml
{{- end}}
{{- if .Values.grafana.sidecar.datasources.enabled }}
{{- if ((.Values.grafana).sidecar).datasources.enabled }}
- name: sc-datasources-volume
mountPath: "/etc/grafana/provisioning/datasources"
{{- end}}
Expand Down Expand Up @@ -293,14 +293,14 @@ spec:
{{- else }}
emptyDir: {}
{{- end -}}
{{- if .Values.grafana.sidecar.dashboards.enabled }}
{{- if (.Values.grafana.sidecar).dashboards.enabled }}
- name: sc-dashboard-volume
emptyDir: {}
- name: sc-dashboard-provider
configMap:
name: {{ template "grafana.fullname" . }}-config-dashboards
{{- end }}
{{- if .Values.grafana.sidecar.datasources.enabled }}
{{- if ((.Values.grafana).sidecar).datasources.enabled }}
- name: sc-datasources-volume
emptyDir: {}
{{- end -}}
Expand Down
43 changes: 22 additions & 21 deletions cost-analyzer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3193,27 +3193,28 @@ grafana:

## Grafana sidecars that collect the configmaps with specified label and stores the included files them into the respective folders
## Requires at least Grafana 5 to work and can't be used together with parameters dashboardProviders, datasources and dashboards
sidecar:
image:
repository: ghcr.io/kiwigrid/k8s-sidecar
tag: 1.27.5
pullPolicy: IfNotPresent
resources: {}
dashboards:
enabled: true
# label that the configmaps with dashboards are marked with
label: grafana_dashboard
labelValue: "1"
# set sidecar ERROR_THROTTLE_SLEEP env var from default 5s to 0s -> fixes https://github.com/kubecost/cost-analyzer-helm-chart/issues/877
annotations: {}
error_throttle_sleep: 0
folder: /tmp/dashboards
datasources:
# dataSourceFilename: foo.yml # If you need to change the name of the datasource file
enabled: false
error_throttle_sleep: 0
# label that the configmaps with datasources are marked with
label: grafana_datasource
## disabled by default in Kubecost 2.5.0, uncomment to enable
# sidecar:
# image:
# repository: ghcr.io/kiwigrid/k8s-sidecar
# tag: 1.27.5
# pullPolicy: IfNotPresent
# resources: {}
# dashboards:
# enabled: true
# # label that the configmaps with dashboards are marked with
# label: grafana_dashboard
# labelValue: "1"
# # set sidecar ERROR_THROTTLE_SLEEP env var from default 5s to 0s -> fixes https://github.com/kubecost/cost-analyzer-helm-chart/issues/877
# annotations: {}
# error_throttle_sleep: 0
# folder: /tmp/dashboards
# datasources:
# # dataSourceFilename: foo.yml # If you need to change the name of the datasource file
# enabled: false
# error_throttle_sleep: 0
# # label that the configmaps with datasources are marked with
# label: grafana_datasource

## Grafana's primary configuration
## NOTE: values in map will be converted to ini format
Expand Down