Skip to content

Commit fd388dd

Browse files
authored
Merge pull request #11416 from sbueringer/pr-disable-machinepool-aggregation
🐛 Disable aggregation of not reported MachinePool conditions for Cluster
2 parents 677f74e + 61d2f8a commit fd388dd

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

internal/controllers/cluster/cluster_controller_status.go

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,33 @@ func (r *Reconciler) updateStatus(ctx context.Context, s *scope) {
4242
// Always reconcile the Status.Phase field.
4343
r.reconcilePhase(ctx, s.cluster)
4444

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+
4558
// replica counters
4659
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)
4861

4962
// conditions
5063
setInfrastructureReadyCondition(ctx, s.cluster, s.infraCluster, s.infraClusterIsNotFound)
5164
setControlPlaneAvailableCondition(ctx, s.cluster, s.controlPlane, s.controlPlaneIsNotFound)
5265
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)
5972
setDeletingCondition(ctx, s.cluster, s.deletingReason, s.deletingMessage)
6073
setAvailableCondition(ctx, s.cluster)
6174
}

0 commit comments

Comments
 (0)