@@ -42,20 +42,33 @@ func (r *Reconciler) updateStatus(ctx context.Context, s *scope) {
42
42
// Always reconcile the Status.Phase field.
43
43
r .reconcilePhase (ctx , s .cluster )
44
44
45
+ // TODO: "expv1.MachinePoolList{}" below should be replaced through "s.descendants.machinePools" once replica counters
46
+ // and Available, ScalingUp and ScalingDown conditions have been implemented for MachinePools.
47
+
48
+ // TODO: This should be removed once the UpToDate condition has been implemented for MachinePool Machines
49
+ isMachinePoolMachine := func (machine * clusterv1.Machine ) bool {
50
+ _ , isMachinePoolMachine := machine .Labels [clusterv1 .MachinePoolNameLabel ]
51
+ return isMachinePoolMachine
52
+ }
53
+ allMachines := s .descendants .allMachines .Filter (collections .Not (isMachinePoolMachine ))
54
+ workerMachines := s .descendants .workerMachines .Filter (collections .Not (isMachinePoolMachine ))
55
+ machinesToBeRemediated := s .descendants .machinesToBeRemediated .Filter (collections .Not (isMachinePoolMachine ))
56
+ unhealthyMachines := s .descendants .unhealthyMachines .Filter (collections .Not (isMachinePoolMachine ))
57
+
45
58
// replica counters
46
59
setControlPlaneReplicas (ctx , s .cluster , s .controlPlane , s .descendants .controlPlaneMachines , s .controlPlaneIsNotFound , s .getDescendantsSucceeded )
47
- setWorkersReplicas (ctx , s .cluster , s . descendants . machinePools , s .descendants .machineDeployments , s .descendants .machineSets , s . descendants . workerMachines , s .getDescendantsSucceeded )
60
+ setWorkersReplicas (ctx , s .cluster , expv1. MachinePoolList {} , s .descendants .machineDeployments , s .descendants .machineSets , workerMachines , s .getDescendantsSucceeded )
48
61
49
62
// conditions
50
63
setInfrastructureReadyCondition (ctx , s .cluster , s .infraCluster , s .infraClusterIsNotFound )
51
64
setControlPlaneAvailableCondition (ctx , s .cluster , s .controlPlane , s .controlPlaneIsNotFound )
52
65
setControlPlaneInitializedCondition (ctx , s .cluster , s .controlPlane , s .descendants .controlPlaneMachines , s .infraClusterIsNotFound , s .getDescendantsSucceeded )
53
- setWorkersAvailableCondition (ctx , s .cluster , s . descendants . machinePools , s .descendants .machineDeployments , s .getDescendantsSucceeded )
54
- setMachinesReadyCondition (ctx , s .cluster , s . descendants . allMachines , s .getDescendantsSucceeded )
55
- setMachinesUpToDateCondition (ctx , s .cluster , s . descendants . allMachines , s .getDescendantsSucceeded )
56
- setScalingUpCondition (ctx , s .cluster , s .controlPlane , s . descendants . machinePools , s .descendants .machineDeployments , s .descendants .machineSets , s .controlPlaneIsNotFound , s .getDescendantsSucceeded )
57
- setScalingDownCondition (ctx , s .cluster , s .controlPlane , s . descendants . machinePools , s .descendants .machineDeployments , s .descendants .machineSets , s .controlPlaneIsNotFound , s .getDescendantsSucceeded )
58
- setRemediatingCondition (ctx , s .cluster , s . descendants . machinesToBeRemediated , s . descendants . unhealthyMachines , s .getDescendantsSucceeded )
66
+ setWorkersAvailableCondition (ctx , s .cluster , expv1. MachinePoolList {} , s .descendants .machineDeployments , s .getDescendantsSucceeded )
67
+ setMachinesReadyCondition (ctx , s .cluster , allMachines , s .getDescendantsSucceeded )
68
+ setMachinesUpToDateCondition (ctx , s .cluster , allMachines , s .getDescendantsSucceeded )
69
+ setScalingUpCondition (ctx , s .cluster , s .controlPlane , expv1. MachinePoolList {} , s .descendants .machineDeployments , s .descendants .machineSets , s .controlPlaneIsNotFound , s .getDescendantsSucceeded )
70
+ setScalingDownCondition (ctx , s .cluster , s .controlPlane , expv1. MachinePoolList {} , s .descendants .machineDeployments , s .descendants .machineSets , s .controlPlaneIsNotFound , s .getDescendantsSucceeded )
71
+ setRemediatingCondition (ctx , s .cluster , machinesToBeRemediated , unhealthyMachines , s .getDescendantsSucceeded )
59
72
setDeletingCondition (ctx , s .cluster , s .deletingReason , s .deletingMessage )
60
73
setAvailableCondition (ctx , s .cluster )
61
74
}
0 commit comments