Skip to content

Commit b5b75b5

Browse files
committed
fix: stop reporting negative unavailable replicas
When comparing nodes list in the workload clsuter with machine count, we can see more nodes than machines, so this check removes a case when stats go weird: ``` NAME READY INITIALIZED REPLICAS READY REPLICAS UNAVAILABLE REPLICAS management-cluster-cp true true 1 2 -1 ``` Signed-off-by: Andrey Smirnov <[email protected]> (cherry picked from commit ac90f86)
1 parent 0cc410e commit b5b75b5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

controllers/taloscontrolplane_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,11 @@ func (r *TalosControlPlaneReconciler) updateStatus(ctx context.Context, tcp *con
580580
}
581581
}
582582

583+
// fix the case then some Node objects are still visible which were deleted
584+
if tcp.Status.ReadyReplicas > tcp.Status.Replicas {
585+
tcp.Status.ReadyReplicas = tcp.Status.Replicas
586+
}
587+
583588
tcp.Status.UnavailableReplicas = replicas - tcp.Status.ReadyReplicas
584589

585590
if tcp.Status.ReadyReplicas > 0 {

0 commit comments

Comments
 (0)