From 0afaefde5874a644acc17c337fddc12194404ce8 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Thu, 1 Jul 2021 13:36:35 +0200 Subject: [PATCH] fix: fix build automation for metrics --- .../charts/kube-state-metrics/values.yaml | 2 +- .../prometheus/rules-1.14/node-exporter.yaml | 2 +- charts/kubezero-metrics/update.sh | 3 +- .../{metrics-zdt.patch => zdt.patch} | 43 +++++++++++-------- 4 files changed, 28 insertions(+), 22 deletions(-) rename charts/kubezero-metrics/{metrics-zdt.patch => zdt.patch} (78%) diff --git a/charts/kubezero-metrics/charts/kube-prometheus-stack/charts/kube-state-metrics/values.yaml b/charts/kubezero-metrics/charts/kube-prometheus-stack/charts/kube-state-metrics/values.yaml index f3bde2cc..1df6254e 100644 --- a/charts/kubezero-metrics/charts/kube-prometheus-stack/charts/kube-state-metrics/values.yaml +++ b/charts/kubezero-metrics/charts/kube-prometheus-stack/charts/kube-state-metrics/values.yaml @@ -162,7 +162,7 @@ collectors: - statefulsets - storageclasses - validatingwebhookconfigurations - # - verticalpodautoscalers + #- verticalpodautoscalers - volumeattachments # Enabling kubeconfig will pass the --kubeconfig argument to the container diff --git a/charts/kubezero-metrics/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node-exporter.yaml b/charts/kubezero-metrics/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node-exporter.yaml index 468e1db9..28660b76 100644 --- a/charts/kubezero-metrics/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node-exporter.yaml +++ b/charts/kubezero-metrics/charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node-exporter.yaml @@ -275,4 +275,4 @@ spec: {{- if .Values.defaultRules.additionalRuleLabels }} {{ toYaml .Values.defaultRules.additionalRuleLabels | indent 8 }} {{- end }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/kubezero-metrics/update.sh b/charts/kubezero-metrics/update.sh index 47c86c5d..d3dde446 100755 --- a/charts/kubezero-metrics/update.sh +++ b/charts/kubezero-metrics/update.sh @@ -7,10 +7,11 @@ curl -L -s -o - https://github.com/prometheus-community/helm-charts/releases/dow # The grpc alerts could be re-enabled with etcd 3.5 # https://github.com/etcd-io/etcd/pull/12196 -patch -p0 -i metrics-zdt.patch --no-backup-if-mismatch +patch -p0 -i zdt.patch --no-backup-if-mismatch # Create ZDT dashboard configmap cd dashboards +./build.sh ../sync_grafana_dashboards.py metrics-dashboards.yaml ../templates/grafana-dashboards-metrics.yaml ../sync_grafana_dashboards.py k8s-dashboards.yaml ../templates/grafana-dashboards-k8s.yaml ../sync_grafana_dashboards.py zdt-dashboards.yaml ../templates/grafana-dashboards-zdt.yaml diff --git a/charts/kubezero-metrics/metrics-zdt.patch b/charts/kubezero-metrics/zdt.patch similarity index 78% rename from charts/kubezero-metrics/metrics-zdt.patch rename to charts/kubezero-metrics/zdt.patch index 4b64f1a7..b056dff8 100644 --- a/charts/kubezero-metrics/metrics-zdt.patch +++ b/charts/kubezero-metrics/zdt.patch @@ -1,7 +1,7 @@ -diff -turN charts/kube-prometheus-stack/charts/grafana/templates/_pod.tpl charts/kube-prometheus-stack.zdt/charts/grafana/templates/_pod.tpl ---- charts/kube-prometheus-stack/charts/grafana/templates/_pod.tpl 2021-04-22 00:36:35.000000000 +0200 -+++ charts/kube-prometheus-stack.zdt/charts/grafana/templates/_pod.tpl 2021-04-25 11:16:06.807876896 +0200 -@@ -197,11 +197,16 @@ +diff -tubr charts/kube-prometheus-stack/charts/grafana/templates/_pod.tpl charts/kube-prometheus-stack.zdt/charts/grafana/templates/_pod.tpl +--- charts/kube-prometheus-stack/charts/grafana/templates/_pod.tpl 2021-06-26 19:54:57.000000000 +0200 ++++ charts/kube-prometheus-stack.zdt/charts/grafana/templates/_pod.tpl 2021-07-01 13:31:20.750609396 +0200 +@@ -198,11 +198,16 @@ - name: FOLDER_ANNOTATION value: "{{ .Values.sidecar.dashboards.folderAnnotation }}" {{- end }} @@ -18,9 +18,21 @@ diff -turN charts/kube-prometheus-stack/charts/grafana/templates/_pod.tpl charts {{- end}} - name: {{ .Chart.Name }} {{- if .Values.image.sha }} -diff -turN charts/kube-prometheus-stack/templates/prometheus/rules-1.14/etcd.yaml charts/kube-prometheus-stack.zdt/templates/prometheus/rules-1.14/etcd.yaml ---- charts/kube-prometheus-stack/templates/prometheus/rules-1.14/etcd.yaml 2021-04-22 00:36:35.000000000 +0200 -+++ charts/kube-prometheus-stack.zdt/templates/prometheus/rules-1.14/etcd.yaml 2021-04-25 11:10:33.021207900 +0200 +diff -tubr charts/kube-prometheus-stack/charts/kube-state-metrics/values.yaml charts/kube-prometheus-stack.zdt/charts/kube-state-metrics/values.yaml +--- charts/kube-prometheus-stack/charts/kube-state-metrics/values.yaml 2021-06-26 19:54:57.000000000 +0200 ++++ charts/kube-prometheus-stack.zdt/charts/kube-state-metrics/values.yaml 2021-07-01 13:33:01.713947294 +0200 +@@ -162,7 +162,7 @@ + - statefulsets + - storageclasses + - validatingwebhookconfigurations +- - verticalpodautoscalers ++ #- verticalpodautoscalers + - volumeattachments + + # Enabling kubeconfig will pass the --kubeconfig argument to the container +diff -tubr charts/kube-prometheus-stack/templates/prometheus/rules-1.14/etcd.yaml charts/kube-prometheus-stack.zdt/templates/prometheus/rules-1.14/etcd.yaml +--- charts/kube-prometheus-stack/templates/prometheus/rules-1.14/etcd.yaml 2021-06-26 19:54:57.000000000 +0200 ++++ charts/kube-prometheus-stack.zdt/templates/prometheus/rules-1.14/etcd.yaml 2021-07-01 13:31:20.750609396 +0200 @@ -54,34 +54,6 @@ {{- if .Values.defaultRules.additionalRuleLabels }} {{ toYaml .Values.defaultRules.additionalRuleLabels | indent 8 }} @@ -56,10 +68,10 @@ diff -turN charts/kube-prometheus-stack/templates/prometheus/rules-1.14/etcd.yam - alert: etcdGRPCRequestsSlow annotations: message: 'etcd cluster "{{`{{`}} $labels.job {{`}}`}}": gRPC requests to {{`{{`}} $labels.grpc_method {{`}}`}} are taking {{`{{`}} $value {{`}}`}}s on etcd instance {{`{{`}} $labels.instance {{`}}`}}.' -diff -turN charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node-exporter.yaml charts/kube-prometheus-stack.zdt/templates/prometheus/rules-1.14/node-exporter.yaml ---- charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node-exporter.yaml 2021-04-22 00:36:35.000000000 +0200 -+++ charts/kube-prometheus-stack.zdt/templates/prometheus/rules-1.14/node-exporter.yaml 2021-04-25 11:10:33.021207900 +0200 -@@ -30,7 +30,7 @@ +diff -tubr charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node-exporter.yaml charts/kube-prometheus-stack.zdt/templates/prometheus/rules-1.14/node-exporter.yaml +--- charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node-exporter.yaml 2021-06-26 19:54:57.000000000 +0200 ++++ charts/kube-prometheus-stack.zdt/templates/prometheus/rules-1.14/node-exporter.yaml 2021-07-01 13:31:20.753942729 +0200 +@@ -31,7 +31,7 @@ summary: Filesystem is predicted to run out of space within the next 24 hours. expr: |- ( @@ -68,7 +80,7 @@ diff -turN charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node-exp and predict_linear(node_filesystem_avail_bytes{job="node-exporter",fstype!=""}[6h], 24*60*60) < 0 and -@@ -48,7 +48,7 @@ +@@ -50,7 +50,7 @@ summary: Filesystem is predicted to run out of space within the next 4 hours. expr: |- ( @@ -77,10 +89,3 @@ diff -turN charts/kube-prometheus-stack/templates/prometheus/rules-1.14/node-exp and predict_linear(node_filesystem_avail_bytes{job="node-exporter",fstype!=""}[6h], 4*60*60) < 0 and -@@ -259,4 +259,4 @@ - {{- if .Values.defaultRules.additionalRuleLabels }} - {{ toYaml .Values.defaultRules.additionalRuleLabels | indent 8 }} - {{- end }} --{{- end }} -\ No newline at end of file -+{{- end }}