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 remove sidecar, remove hardcoded values #3705

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from
2 changes: 1 addition & 1 deletion cost-analyzer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: development
description: Kubecost Helm chart - monitor your cloud costs!
name: cost-analyzer
version: 2.3.3
version: 2.3.3-dev-5
icon: https://raw.githubusercontent.com/kubecost/.github/9602bea0c06773da66ba43cb9ce5e1eb2b797c32/kubecost_logo.png
annotations:
"artifacthub.io/links": |
Expand Down
Binary file added cost-analyzer/cost-analyzer-2.3.3-dev-4.tgz
Binary file not shown.
Binary file added cost-analyzer/cost-analyzer-2.3.3-dev-5.tgz
Binary file not shown.
Binary file added cost-analyzer/cost-analyzer-2.3.3-dev.tgz
Binary file not shown.
24 changes: 12 additions & 12 deletions cost-analyzer/grafana-dashboards/attached-disks.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
"uid": "${prometheusDS}"
},
"fieldConfig": {
"defaults": {
Expand Down Expand Up @@ -112,7 +112,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
"uid": "${prometheusDS}"
},
"editorMode": "code",
"expr": "sum(container_fs_limit_bytes{instance=~'$disk', device!=\"tmpfs\", id=\"/\", cluster_id=~'$cluster'}) by (cluster_id, instance)",
Expand All @@ -130,7 +130,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
"uid": "${prometheusDS}"
},
"fieldConfig": {
"defaults": {
Expand Down Expand Up @@ -213,7 +213,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
"uid": "${prometheusDS}"
},
"editorMode": "code",
"expr": "sum(container_fs_usage_bytes{instance=~'$disk',id=\"/\", cluster_id=~'$cluster'}) by (cluster_id, instance) / sum(container_fs_limit_bytes{instance=~'$disk',device!=\"tmpfs\", id=\"/\", cluster_id=~'$cluster'}) by (cluster_id,instance)",
Expand All @@ -231,7 +231,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
"uid": "${prometheusDS}"
},
"fieldConfig": {
"defaults": {
Expand Down Expand Up @@ -314,7 +314,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
"uid": "${prometheusDS}"
},
"editorMode": "code",
"expr": "1 - sum(container_fs_inodes_free{instance=~'$disk',id=\"/\", cluster_id=~'$cluster'}) by (cluster_id, instance) / sum(container_fs_inodes_total{instance=~'$disk',id=\"/\", cluster_id=~'$cluster'}) by (cluster_id, instance)",
Expand All @@ -331,7 +331,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
"uid": "${prometheusDS}"
},
"fieldConfig": {
"defaults": {
Expand Down Expand Up @@ -412,7 +412,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
"uid": "${prometheusDS}"
},
"editorMode": "code",
"expr": "sum(container_fs_usage_bytes{instance=~'$disk',id=\"/\", cluster_id=~'$cluster'}) by (cluster_id, instance)",
Expand Down Expand Up @@ -441,12 +441,12 @@
"current": {
"selected": false,
"text": "Prometheus",
"value": "PBFA97CFB590B2093"
"value": "Prometheus"
},
"hide": 0,
"includeAll": false,
"multi": false,
"name": "datasource",
"name": "prometheusDS",
"options": [],
"query": "prometheus",
"queryValue": "",
Expand All @@ -463,7 +463,7 @@
},
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
"uid": "${prometheusDS}"
},
"definition": "label_values(cluster_id)",
"hide": 0,
Expand All @@ -489,7 +489,7 @@
},
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
"uid": "${prometheusDS}"
},
"definition": "label_values(container_fs_limit_bytes{cluster_id=~\"$cluster\"}, instance)",
"hide": 0,
Expand Down
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 }}
6 changes: 3 additions & 3 deletions cost-analyzer/templates/grafana-dashboard-attached-disks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
attached-disks.json: |-
{{- .Files.Get "grafana-dashboards/attached-disks.json" | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
cluster-metrics.json: |-
{{- .Files.Get "grafana-dashboards/cluster-metrics.json" | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
cluster-utilization.json: |-
{{- .Files.Get "grafana-dashboards/cluster-utilization.json" | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
deployment-utilization.json: |-
{{- .Files.Get "grafana-dashboards/deployment-utilization.json" | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
kubernetes-resource-efficiency.json: |-
{{- .Files.Get "grafana-dashboards/kubernetes-resource-efficiency.json" | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
label-cost-utilization.json: |-
{{- .Files.Get "grafana-dashboards/label-cost-utilization.json" | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
namespace-utilization.json: |-
{{- .Files.Get "grafana-dashboards/namespace-utilization.json" | nindent 4 }}
Expand Down
6 changes: 3 additions & 3 deletions cost-analyzer/templates/grafana-dashboard-network-costs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
networkCosts-metrics.json: |-
{{- .Files.Get "grafana-dashboards/networkCosts-metrics.json" | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
node-utilization.json: |-
{{- .Files.Get "grafana-dashboards/node-utilization.json" | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
pod-utilization-multi-cluster.json: |-
{{- .Files.Get "grafana-dashboards/pod-utilization-multi-cluster.json" | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
pod-utilization.json: |-
{{- .Files.Get "grafana-dashboards/pod-utilization.json" | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
prom-benchmark.json: |-
{{- .Files.Get "grafana-dashboards/prom-benchmark.json" | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
workload-metrics-aggregator.json: |-
{{- .Files.Get "grafana-dashboards/workload-metrics-aggregator.json" | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ metadata:
{{- end }}
labels:
{{- include "cost-analyzer.commonLabels" . | nindent 4 }}
{{- if $.Values.grafana.sidecar.dashboards.label }}
{{ $.Values.grafana.sidecar.dashboards.label }}: "{{ $.Values.grafana.sidecar.dashboards.labelValue }}"
{{- if $ ((.Values.grafana).sidecar).dashboards.label }}
{{ $ ((.Values.grafana).sidecar).dashboards.label }}: "{{ $ ((.Values.grafana).sidecar).dashboards.labelValue }}"
{{- else }}
grafana_dashboard: "1"
{{- end }}
annotations:
{{- toYaml .Values.grafana.sidecar.dashboards.annotations | nindent 4 }}
{{- toYaml ((.Values.grafana).sidecar).dashboards.annotations | nindent 4 }}
data:
grafana-workload-metrics.json: |-
{{- .Files.Get "grafana-dashboards/workload-metrics.json" | nindent 4 }}
Expand Down
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 -}}
Loading
Loading