Commit d8cffef0 by Frank Mai Committed by Denise

Fixed duplicate measure

**Problem:** Duplicate measure in `container_*` metrics when scraping >=v1.16 kubelet endpoint in TLS: the bottom `metricRelabelings` would replace the top one. **Solution:** Merge both two `metricRelabelings` in TLS scraping, and fix wrong `labeldrop` when scraping in non-TLS.
parent 257371cd
...@@ -55,9 +55,6 @@ spec: ...@@ -55,9 +55,6 @@ spec:
{{- if .Values.insecureSkipVerify }} {{- if .Values.insecureSkipVerify }}
insecureSkipVerify: true insecureSkipVerify: true
{{- end }} {{- end }}
metricRelabelings:
- action: labeldrop
regex: (^id$|^image$|^name$|^cpu$)
relabelings: relabelings:
- sourceLabels: - sourceLabels:
- __meta_kubernetes_pod_host_ip - __meta_kubernetes_pod_host_ip
...@@ -71,8 +68,10 @@ spec: ...@@ -71,8 +68,10 @@ spec:
action: replace action: replace
regex: (.+) regex: (.+)
replacement: $1 replacement: $1
{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
metricRelabelings: metricRelabelings:
- action: labeldrop
regex: (^id$|^image$|^name$|^cpu$)
{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
- action: replace - action: replace
regex: (.+) regex: (.+)
replacement: $1 replacement: $1
...@@ -111,9 +110,6 @@ spec: ...@@ -111,9 +110,6 @@ spec:
targetLabel: pod_name targetLabel: pod_name
{{- else }} {{- else }}
- port: http-metrics - port: http-metrics
metricRelabelings:
- action: labeldrop
regex: (^id$|^image$|^name$|^cpu$)
relabelings: relabelings:
- sourceLabels: - sourceLabels:
- __meta_kubernetes_pod_host_ip - __meta_kubernetes_pod_host_ip
...@@ -143,8 +139,10 @@ spec: ...@@ -143,8 +139,10 @@ spec:
action: replace action: replace
regex: (.+) regex: (.+)
replacement: $1 replacement: $1
{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
metricRelabelings: metricRelabelings:
- action: labeldrop
regex: (^id$|^image$|^name$|^cpu$)
{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
- action: replace - action: replace
regex: (.+) regex: (.+)
replacement: $1 replacement: $1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment