Skip to content

Commit

Permalink
descope
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Oct 15, 2024
1 parent 7edfa73 commit 417a033
Showing 1 changed file with 5 additions and 38 deletions.
43 changes: 5 additions & 38 deletions internal/controllers/machineset/machineset_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,15 @@ func (r *Reconciler) reconcileStatus(_ context.Context, s *scope) {

// MachinesReady
setMachinesReadyCondition(s.machineSet, s.machines)
// MachinesUpToDate
setMachinesUpToDateCondition(s.machineSet, s.machines)

// Deleting
setDeletingCondition(s.machineSet)
// TODO MachinesUpToDate

// TODO Deleting
}

func setReplicas(ms *clusterv1.MachineSet, machines []*clusterv1.Machine) {
if machines == nil {
// TODO: what about replicas fields? Not touch?!
// TODO: what todo if listing machines failed? Not touch replicas?
return
}

Expand All @@ -80,7 +79,7 @@ func setReplicas(ms *clusterv1.MachineSet, machines []*clusterv1.Machine) {

func setScalingUpCondition(ms *clusterv1.MachineSet, machines []*clusterv1.Machine) {
if machines == nil {
// Question: should we only do this if the condition does not exist?
// TODO(chrischdi): Question: should we only do this if the condition does not exist?
v1beta2conditions.Set(ms, metav1.Condition{
Type: clusterv1.MachineSetScalingUpV1Beta2Condition,
Status: metav1.ConditionUnknown,
Expand Down Expand Up @@ -120,8 +119,6 @@ func setScalingDownCondition(ms *clusterv1.MachineSet, machines []*clusterv1.Mac
Reason: "InternalError", // TODO: create a const.
Message: "Please check controller logs for errors",
})

// TODO: what about replicas fields? Not touch?
return
}

Expand Down Expand Up @@ -170,33 +167,3 @@ func setMachinesReadyCondition(machineSet *clusterv1.MachineSet, machines []*clu
}
v1beta2conditions.Set(machineSet, *readyCondition)
}

func setMachinesUpToDateCondition(machineSet *clusterv1.MachineSet, machines []*clusterv1.Machine) {
if err := v1beta2conditions.SetAggregateCondition(machines, machineSet,
clusterv1.MachinesUpToDateV1Beta2Condition,
v1beta2conditions.TargetConditionType(clusterv1.MachineSetMachinesUpToDateV1Beta2Condition),
); err != nil {
v1beta2conditions.Set(machineSet, metav1.Condition{
Type: clusterv1.MachineSetMachinesUpToDateV1Beta2Condition,
Status: metav1.ConditionFalse,
Reason: "TODOFailedDuringAggregation",
Message: "something TODO on MachinesUpToDate",
})
}
}

func setDeletingCondition(ms *clusterv1.MachineSet) {
if !ms.DeletionTimestamp.IsZero() {
v1beta2conditions.Set(ms, metav1.Condition{
Type: clusterv1.MachineSetDeletingV1Beta2Condition,
Status: metav1.ConditionTrue,
Reason: "DeletionTimestampSet", // TODO: create a const.
})
return
}
v1beta2conditions.Set(ms, metav1.Condition{
Type: clusterv1.MachineSetDeletingV1Beta2Condition,
Status: metav1.ConditionFalse,
Reason: "NoDeletionTimestamp", // TODO: create a const.
})
}

0 comments on commit 417a033

Please sign in to comment.