fix(ingress): keep application identity off ingress-nginx series

The vmagent scrape class stamps the scraped pod's application identity
on its series. ingress-nginx series describe the Ingress objects the
controller serves, in whatever namespace they live, so the controller's
own identity would attribute another tenant's traffic to the Ingress
application. And because these scrapes honor exporter labels, an
exporter-supplied identity would win over the class. Dropping the labels
leaves these series to the pod and namespace scopes.

Assisted-by: LLM
Signed-off-by: ZverGuy <maximbel2003@gmail.com>
This commit is contained in:
ZverGuy committed 2026-11-04 04:26:04 +07:00
1 parent 14f815a5cc
commit 0e5557d0ba
2 files changed
+31

No files matched your search

@@ -9,6 +9,10 @@ spec:
matchNames:
- {{ .Release.Namespace }}
podMetricsEndpoints:
# The series describe the Ingress objects served, in any namespace, not
# this controller, so the application identity the vmagent scrape class
# stamps from the controller pod would misattribute them; and with
# honorLabels an exporter-supplied identity would win over the class.
- port: metrics
honorLabels: true
interval: 30s
@@ -19,6 +23,9 @@ spec:
targetLabel: node
- targetLabel: tier
replacement: cluster
metricRelabelConfigs:
- action: labeldrop
regex: apps_cozystack_io_application_(group|kind|name)
selector:
matchLabels:
app.kubernetes.io/component: controller
@@ -46,6 +53,9 @@ spec:
targetLabel: controller
- targetLabel: tier
replacement: cluster
metricRelabelConfigs:
- action: labeldrop
regex: apps_cozystack_io_application_(group|kind|name)
selector:
matchLabels:
app.kubernetes.io/component: controller
@@ -0,0 +1,21 @@
suite: ingress-nginx series do not carry an application identity
templates:
- templates/nginx-scrape.yaml
release:
name: ingress
namespace: tenant-root
# The vmagent scrape class stamps the scraped pod's application identity on
# every series. ingress-nginx series describe the Ingress objects it serves,
# in whatever namespace they live (honorLabels keeps their namespace), so
# the controller's identity would misattribute them, and with honorLabels
# true an exporter-supplied identity would win over the class. Both
# endpoints drop the identity instead.
tests:
- it: drops the identity on every endpoint
asserts:
- equal:
path: spec.podMetricsEndpoints[0].metricRelabelConfigs
value:
- action: labeldrop
regex: apps_cozystack_io_application_(group|kind|name)