From 33def3469614c794932e202154ebb49ea29ead50 Mon Sep 17 00:00:00 2001 From: HaveFun83 Date: Fri, 19 Mar 2021 17:19:26 +0100 Subject: [PATCH 1/3] extend servicemonitor with metric relabel config Signed-off-by: HaveFun83 --- charts/fluentd/Chart.yaml | 2 +- charts/fluentd/templates/servicemonitor.yaml | 9 +++++++++ charts/fluentd/values.yaml | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/charts/fluentd/Chart.yaml b/charts/fluentd/Chart.yaml index b70dac89..cdd2fa26 100644 --- a/charts/fluentd/Chart.yaml +++ b/charts/fluentd/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: fluentd description: A Helm chart for Kubernetes # type: application -version: 0.2.3 +version: 0.2.4 appVersion: v1.12.0 icon: https://www.fluentd.org/assets/img/miscellany/fluentd-logo_2x.png home: https://www.fluentd.org/ diff --git a/charts/fluentd/templates/servicemonitor.yaml b/charts/fluentd/templates/servicemonitor.yaml index 4b542bdc..d83004da 100644 --- a/charts/fluentd/templates/servicemonitor.yaml +++ b/charts/fluentd/templates/servicemonitor.yaml @@ -12,6 +12,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: + jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | default "fluentd" }} endpoints: - port: metrics path: /metrics @@ -21,6 +22,14 @@ spec: {{- with .Values.metrics.serviceMonitor.scrapeTimeout }} scrapeTimeout: {{ . }} {{- end }} +{{- if .Values.metrics.serviceMonitor.metricRelabelings }} + metricRelabelings: +{{ tpl (toYaml .Values.metrics.serviceMonitor.metricRelabelings | indent 6) . }} +{{- end }} +{{- if .Values.metrics.serviceMonitor.relabelings }} + relabelings: +{{ toYaml .Values.metrics.serviceMonitor.relabelings | indent 6 }} +{{- end }} {{- if .Values.metrics.serviceMonitor.namespaceSelector }} namespaceSelector: {{ toYaml .Values.metrics.serviceMonitor.namespaceSelector | indent 4 -}} diff --git a/charts/fluentd/values.yaml b/charts/fluentd/values.yaml index 3ee6b988..ec24921a 100644 --- a/charts/fluentd/values.yaml +++ b/charts/fluentd/values.yaml @@ -135,6 +135,11 @@ metrics: release: prometheus-operator namespace: "" namespaceSelector: {} + ## metric relabel configs to apply to samples before ingestion. + metricRelabelings: [] + ## relabel configs to apply to samples before ingestion. + relabelings: [] + # jobLabel: fluentd # scrapeInterval: 30s # scrapeTimeout: 5s # honorLabels: true From 5b83a217061920ffde0e3aa38eb6520b35be0d54 Mon Sep 17 00:00:00 2001 From: HaveFun83 Date: Fri, 19 Mar 2021 17:25:05 +0100 Subject: [PATCH 2/3] fixed comment in values.yaml Signed-off-by: HaveFun83 --- charts/fluentd/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/fluentd/values.yaml b/charts/fluentd/values.yaml index ec24921a..f1f79eab 100644 --- a/charts/fluentd/values.yaml +++ b/charts/fluentd/values.yaml @@ -135,9 +135,9 @@ metrics: release: prometheus-operator namespace: "" namespaceSelector: {} - ## metric relabel configs to apply to samples before ingestion. + ## metric relabel configs to apply to samples before ingestion. metricRelabelings: [] - ## relabel configs to apply to samples before ingestion. + ## relabel configs to apply to samples before ingestion. relabelings: [] # jobLabel: fluentd # scrapeInterval: 30s From 1fc671f6983afa0800e0eb6024fc8b03c8ffb229 Mon Sep 17 00:00:00 2001 From: HaveFun83 Date: Mon, 22 Mar 2021 10:12:09 +0100 Subject: [PATCH 3/3] added example for relabel config and fixed joblabel Signed-off-by: HaveFun83 --- charts/fluentd/templates/servicemonitor.yaml | 2 +- charts/fluentd/values.yaml | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/charts/fluentd/templates/servicemonitor.yaml b/charts/fluentd/templates/servicemonitor.yaml index d83004da..521b6c53 100644 --- a/charts/fluentd/templates/servicemonitor.yaml +++ b/charts/fluentd/templates/servicemonitor.yaml @@ -12,7 +12,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | default "fluentd" }} + jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | default .Release.Name }} endpoints: - port: metrics path: /metrics diff --git a/charts/fluentd/values.yaml b/charts/fluentd/values.yaml index f1f79eab..ef5ddfd0 100644 --- a/charts/fluentd/values.yaml +++ b/charts/fluentd/values.yaml @@ -136,9 +136,24 @@ metrics: namespace: "" namespaceSelector: {} ## metric relabel configs to apply to samples before ingestion. + ## metricRelabelings: [] - ## relabel configs to apply to samples before ingestion. + # - sourceLabels: [__name__] + # separator: ; + # regex: ^fluentd_output_status_buffer_(oldest|newest)_.+ + # replacement: $1 + # action: drop + ## relabel configs to apply to samples after ingestion. + ## relabelings: [] + # - sourceLabels: [__meta_kubernetes_pod_node_name] + # separator: ; + # regex: ^(.*)$ + # targetLabel: nodename + # replacement: $1 + # action: replace + ## Additional serviceMonitor config + ## # jobLabel: fluentd # scrapeInterval: 30s # scrapeTimeout: 5s