From d32514a40a35748de89e46b949f483d20d279b75 Mon Sep 17 00:00:00 2001 From: Jeremy PLANCKEEL Date: Tue, 9 Aug 2022 15:41:08 +0200 Subject: [PATCH 1/3] fix(helm): correct helm relabeling --- .github/workflows/helm-test.yml | 2 +- .../templates/monitor.yaml | 4 +- helm/prescaling-exporter/values.yaml | 41 ++++++++++++++-- helm/test-values.yml | 47 +++++++++++++++++++ 4 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 helm/test-values.yml diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml index c55336f..5eac9d7 100644 --- a/.github/workflows/helm-test.yml +++ b/.github/workflows/helm-test.yml @@ -23,4 +23,4 @@ jobs: run : helm lint ./helm/prescaling-exporter - name: Helm3 template - run : helm template prescaling-exporter helm/prescaling-exporter + run : helm template prescaling-exporter helm/prescaling-exporter -f helm/test-values.yml diff --git a/helm/prescaling-exporter/templates/monitor.yaml b/helm/prescaling-exporter/templates/monitor.yaml index cffab6c..5e3db7e 100644 --- a/helm/prescaling-exporter/templates/monitor.yaml +++ b/helm/prescaling-exporter/templates/monitor.yaml @@ -20,7 +20,7 @@ spec: {{- end }} {{- if .Values.prometheus.monitor.relabelings }} relabelings: - {{ toYaml .Values.prometheus.monitor.relabelings | indent 8 }} + {{ toYaml .Values.prometheus.monitor.relabelings | nindent 8 }} {{- end }} {{- end -}} @@ -41,7 +41,7 @@ spec: scrapeTimeout: {{ .Values.victoriametrics.monitor.scrapeTimeout }} {{- if .Values.victoriametrics.monitor.relabelings }} relabelConfigs: - {{ toYaml .Values.victoriametrics.monitor.relabelings | indent 8 }} + {{ toYaml .Values.victoriametrics.monitor.relabelings | nindent 8 }} {{- end }} jobLabel: {{ template "prescaling-exporter.fullname" . }} selector: diff --git a/helm/prescaling-exporter/values.yaml b/helm/prescaling-exporter/values.yaml index 7d319a2..8059b9c 100644 --- a/helm/prescaling-exporter/values.yaml +++ b/helm/prescaling-exporter/values.yaml @@ -80,17 +80,50 @@ resources: # Configure Prometheus service scrapping with prometheus: monitor: - enabled: false + enabled: true additionalLabels: {} - relabelings: [] + relabelings: + - action: replace + regex: (.*) + replacement: $1 + sourceLabels: + - __meta_kubernetes_pod_name + targetLabel: kubernetes_pod_name + - action: replace + regex: (.*) + replacement: $1 + sourceLabels: + - __meta_kubernetes_namespace + targetLabel: kubernetes_namespace + - action: labelmap + regex: __meta_kubernetes_pod_label_(.+) + - action: labeldrop + regex: (endpoint|pod_template_hash|pod_template_generation|controller_revision_hash) + scrapeTimeout: 10s # Configure VictoiraMetrics service scrapping with victoriametrics: monitor: - enabled: false + enabled: true additionalLabels: {} - relabelings: [] + relabelings: + - action: replace + regex: (.*) + replacement: $1 + sourceLabels: + - __meta_kubernetes_pod_name + targetLabel: kubernetes_pod_name + - action: replace + regex: (.*) + replacement: $1 + sourceLabels: + - __meta_kubernetes_namespace + targetLabel: kubernetes_namespace + - action: labelmap + regex: __meta_kubernetes_pod_label_(.+) + - action: labeldrop + regex: (endpoint|pod_template_hash|pod_template_generation|controller_revision_hash) scrapeTimeout: 10s autoscaling: diff --git a/helm/test-values.yml b/helm/test-values.yml new file mode 100644 index 0000000..dfd75ef --- /dev/null +++ b/helm/test-values.yml @@ -0,0 +1,47 @@ +# Configure Prometheus service scrapping with +prometheus: + monitor: + enabled: false + additionalLabels: {} + relabelings: + - action: replace + regex: (.*) + replacement: $1 + sourceLabels: + - __meta_kubernetes_pod_name + targetLabel: kubernetes_pod_name + - action: replace + regex: (.*) + replacement: $1 + sourceLabels: + - __meta_kubernetes_namespace + targetLabel: kubernetes_namespace + - action: labelmap + regex: __meta_kubernetes_pod_label_(.+) + - action: labeldrop + regex: (endpoint|pod_template_hash|pod_template_generation|controller_revision_hash) + scrapeTimeout: 10s + +# Configure VictoiraMetrics service scrapping with +victoriametrics: + monitor: + enabled: true + additionalLabels: {} + relabelings: + - action: replace + regex: (.*) + replacement: $1 + sourceLabels: + - __meta_kubernetes_pod_name + targetLabel: kubernetes_pod_name + - action: replace + regex: (.*) + replacement: $1 + sourceLabels: + - __meta_kubernetes_namespace + targetLabel: kubernetes_namespace + - action: labelmap + regex: __meta_kubernetes_pod_label_(.+) + - action: labeldrop + regex: (endpoint|pod_template_hash|pod_template_generation|controller_revision_hash) + scrapeTimeout: 10s From 52b538724b4d97215f413659bfe167eea6ecbb22 Mon Sep 17 00:00:00 2001 From: Jeremy PLANCKEEL Date: Tue, 9 Aug 2022 16:43:58 +0200 Subject: [PATCH 2/3] fix(helm):, remove test in values.yaml --- helm/prescaling-exporter/values.yaml | 37 ++-------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/helm/prescaling-exporter/values.yaml b/helm/prescaling-exporter/values.yaml index 8059b9c..1baf53c 100644 --- a/helm/prescaling-exporter/values.yaml +++ b/helm/prescaling-exporter/values.yaml @@ -82,24 +82,7 @@ prometheus: monitor: enabled: true additionalLabels: {} - relabelings: - - action: replace - regex: (.*) - replacement: $1 - sourceLabels: - - __meta_kubernetes_pod_name - targetLabel: kubernetes_pod_name - - action: replace - regex: (.*) - replacement: $1 - sourceLabels: - - __meta_kubernetes_namespace - targetLabel: kubernetes_namespace - - action: labelmap - regex: __meta_kubernetes_pod_label_(.+) - - action: labeldrop - regex: (endpoint|pod_template_hash|pod_template_generation|controller_revision_hash) - + relabelings: [] scrapeTimeout: 10s # Configure VictoiraMetrics service scrapping with @@ -107,23 +90,7 @@ victoriametrics: monitor: enabled: true additionalLabels: {} - relabelings: - - action: replace - regex: (.*) - replacement: $1 - sourceLabels: - - __meta_kubernetes_pod_name - targetLabel: kubernetes_pod_name - - action: replace - regex: (.*) - replacement: $1 - sourceLabels: - - __meta_kubernetes_namespace - targetLabel: kubernetes_namespace - - action: labelmap - regex: __meta_kubernetes_pod_label_(.+) - - action: labeldrop - regex: (endpoint|pod_template_hash|pod_template_generation|controller_revision_hash) + relabelings: [] scrapeTimeout: 10s autoscaling: From c03181871027de97514860ce57c3fc9f30cd0888 Mon Sep 17 00:00:00 2001 From: Jeremy PLANCKEEL Date: Tue, 9 Aug 2022 16:45:47 +0200 Subject: [PATCH 3/3] fix(helm): disable monitors --- helm/prescaling-exporter/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/prescaling-exporter/values.yaml b/helm/prescaling-exporter/values.yaml index 1baf53c..7d319a2 100644 --- a/helm/prescaling-exporter/values.yaml +++ b/helm/prescaling-exporter/values.yaml @@ -80,7 +80,7 @@ resources: # Configure Prometheus service scrapping with prometheus: monitor: - enabled: true + enabled: false additionalLabels: {} relabelings: [] scrapeTimeout: 10s @@ -88,7 +88,7 @@ prometheus: # Configure VictoiraMetrics service scrapping with victoriametrics: monitor: - enabled: true + enabled: false additionalLabels: {} relabelings: [] scrapeTimeout: 10s