Skip to content

Commit 9ccda86

Browse files
committed
add logical cluster count for all clusters, despite their readiness
Signed-off-by: Karol Szwaj <[email protected]> On-behalf-of: @SAP [email protected]
1 parent b172e3a commit 9ccda86

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

pkg/reconciler/tenancy/logicalcluster/logicalcluster_controller.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ func (c *Controller) process(ctx context.Context, key string) error {
203203

204204
logicalCluster, err := c.logicalClusterLister.Cluster(clusterName).Get(corev1alpha1.LogicalClusterName)
205205
if err != nil {
206-
if apierrors.IsNotFound(err) {
206+
if !apierrors.IsNotFound(err) {
207207
logger.Error(err, "failed to get LogicalCluster from lister", "cluster", clusterName)
208208
}
209-
return nil
209+
return nil // nothing we can do here
210210
}
211211

212212
logger = logging.WithObject(logger, logicalCluster)
@@ -275,15 +275,13 @@ func (c *Controller) handleMetrics(obj any) {
275275
return
276276
}
277277

278-
if logicalCluster.Status.Phase == corev1alpha1.LogicalClusterPhaseReady {
279-
c.mu.Lock()
280-
clusterKey := string(logicalcluster.From(logicalCluster))
281-
if !c.countedClusters[clusterKey] {
282-
c.countedClusters[clusterKey] = true
283-
kcpmetrics.IncrementLogicalClusterCount(c.shardName)
284-
}
285-
c.mu.Unlock()
278+
c.mu.Lock()
279+
clusterKey := string(logicalcluster.From(logicalCluster))
280+
if !c.countedClusters[clusterKey] {
281+
c.countedClusters[clusterKey] = true
282+
kcpmetrics.IncrementLogicalClusterCount(c.shardName)
286283
}
284+
c.mu.Unlock()
287285
}
288286

289287
func (c *Controller) handleMetricsOnDelete(obj any) {

0 commit comments

Comments
 (0)