From 2960014ef504eb8ecbdbcc166d79ba680dec6830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A5=96=E5=BB=BA?= Date: Thu, 29 Aug 2024 10:32:45 +0800 Subject: [PATCH] metrics: do not export information if a subnet is not validated (#4444) Signed-off-by: zhangzujian --- pkg/controller/exporter.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/controller/exporter.go b/pkg/controller/exporter.go index 1e86d8a395a..3cfab0ac749 100644 --- a/pkg/controller/exporter.go +++ b/pkg/controller/exporter.go @@ -39,6 +39,10 @@ func (c *Controller) exportSubnetMetrics() { resetSubnetMetrics() for _, subnet := range subnets { + if !subnet.Status.IsValidated() { + continue + } + c.exportSubnetAvailableIPsGauge(subnet) c.exportSubnetUsedIPsGauge(subnet) c.exportSubnetIPAMInfo(subnet)