From 3390100226a60f8e399fc589f42c5dbe32af4e27 Mon Sep 17 00:00:00 2001 From: ZverGuy Date: Thu, 5 Nov 2026 00:21:26 +0700 Subject: [PATCH] docs(monitoring): state which scrapes the identity class covers The comment promised identity labels on every target and forbade scrape objects from touching them. Neither holds: operator v0.68.4 applies only a class's auth to VMProbe (factory/vmagent/probe.go), raw scrape configs bypass classes, and the cadvisor, kubelet and ingress-nginx scrapes drop the labels on purpose. The real invariant for a scrape object is that it never sets them; dropping them is safe. Assisted-by: LLM Signed-off-by: ZverGuy --- .../monitoring-agents/templates/vmagent.yaml | 18 ++++++++++-------- .../vmagent_application_identity_test.yaml | 4 ++-- .../monitoring/templates/vm/vmagent.yaml | 18 ++++++++++-------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/packages/system/monitoring-agents/templates/vmagent.yaml b/packages/system/monitoring-agents/templates/vmagent.yaml index ad26881b7..e001fc40f 100644 --- a/packages/system/monitoring-agents/templates/vmagent.yaml +++ b/packages/system/monitoring-agents/templates/vmagent.yaml @@ -20,14 +20,16 @@ spec: scrapeInterval: 30s selectAllByDefault: true - # The target always carries all three identity labels, "-" when the pod - # has no lineage ("-" is not a valid Kubernetes label value, so it never - # collides with a real one). Under honorLabels false every exporter-supplied - # copy then collides, is renamed to exported_* and dropped. Under - # honorLabels true the exporter's copy wins, so such a scrape must drop - # these labels itself. A scrape object's own relabel rules run after these - # and must leave the labels alone. The placeholder is removed by the - # remote-write relabeling below. + # The class sets all three identity labels on every target it covers, "-" + # when the pod has no lineage ("-" is not a valid Kubernetes label value, + # so it never collides with a real one). Under honorLabels false every + # exporter-supplied copy then collides, is renamed to exported_* and + # dropped. Under honorLabels true the exporter's copy wins, so such a + # scrape must drop these labels itself. A scrape object's own relabel + # rules run after these: they may drop the labels but must never set them. + # Not covered: VMProbe (operator v0.68.4 takes only auth from a class) and + # raw scrape configs. The placeholder is removed by the remote-write + # relabeling below. scrapeClasses: - name: application-identity default: true diff --git a/packages/system/monitoring-agents/tests/vmagent_application_identity_test.yaml b/packages/system/monitoring-agents/tests/vmagent_application_identity_test.yaml index 95f330d50..4e4b93385 100644 --- a/packages/system/monitoring-agents/tests/vmagent_application_identity_test.yaml +++ b/packages/system/monitoring-agents/tests/vmagent_application_identity_test.yaml @@ -7,8 +7,8 @@ release: # The tenant-resource-metrics proxy scopes a query to one application by # apps_cozystack_io_application_{group,kind,name}. The labels are only a -# boundary if the scraped pod cannot choose them: the target always carries -# all three (a placeholder when the pod has no lineage), so with +# boundary if the scraped pod cannot choose them: the class sets all three +# on every target it covers (a placeholder when the pod has no lineage), so with # honorLabels false an exporter's own copy is renamed to exported_* and # dropped. The same rules live in the tenant vmagent of the monitoring # package and are pinned there by the same assertions. diff --git a/packages/system/monitoring/templates/vm/vmagent.yaml b/packages/system/monitoring/templates/vm/vmagent.yaml index 2748ac4bf..919fdef63 100644 --- a/packages/system/monitoring/templates/vm/vmagent.yaml +++ b/packages/system/monitoring/templates/vm/vmagent.yaml @@ -24,14 +24,16 @@ spec: scrapeInterval: 30s selectAllByDefault: false - # The target always carries all three identity labels, "-" when the pod - # has no lineage ("-" is not a valid Kubernetes label value, so it never - # collides with a real one). Under honorLabels false every exporter-supplied - # copy then collides, is renamed to exported_* and dropped. Under - # honorLabels true the exporter's copy wins, so such a scrape must drop - # these labels itself. A scrape object's own relabel rules run after these - # and must leave the labels alone. The placeholder is removed by the - # remote-write relabeling below. + # The class sets all three identity labels on every target it covers, "-" + # when the pod has no lineage ("-" is not a valid Kubernetes label value, + # so it never collides with a real one). Under honorLabels false every + # exporter-supplied copy then collides, is renamed to exported_* and + # dropped. Under honorLabels true the exporter's copy wins, so such a + # scrape must drop these labels itself. A scrape object's own relabel + # rules run after these: they may drop the labels but must never set them. + # Not covered: VMProbe (operator v0.68.4 takes only auth from a class) and + # raw scrape configs. The placeholder is removed by the remote-write + # relabeling below. scrapeClasses: - name: application-identity default: true