diff --git a/pkg/controller/cluster/monitoring.go b/pkg/controller/cluster/monitoring.go index c19a6c50e7c..232083d6fd7 100644 --- a/pkg/controller/cluster/monitoring.go +++ b/pkg/controller/cluster/monitoring.go @@ -250,10 +250,12 @@ func (c *Controller) updateHealthStatusForTenant(tenant *miniov2.Tenant) error { if err != nil { klog.Infof("'%s/%s' Can't generate tenant prometheus token: %v", tenant.Namespace, tenant.Name, err) } else { - tenant.Status.Usage.Usage = metrics.Usage - tenant.Status.Usage.Capacity = metrics.UsableCapacity - if tenant, err = c.updatePoolStatus(context.Background(), tenant); err != nil { - klog.Infof("'%s/%s' Can't update tenant status for usage: %v", tenant.Namespace, tenant.Name, err) + if metrics != nil { + tenant.Status.Usage.Usage = metrics.Usage + tenant.Status.Usage.Capacity = metrics.UsableCapacity + if tenant, err = c.updatePoolStatus(context.Background(), tenant); err != nil { + klog.Infof("'%s/%s' Can't update tenant status for usage: %v", tenant.Namespace, tenant.Name, err) + } } }