Skip to content

Commit

Permalink
remove requeue when not ready
Browse files Browse the repository at this point in the history
  • Loading branch information
CecileRobertMichon committed Nov 16, 2023
1 parent 5e3205f commit 91fa5c4
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package controllers
import (
"context"
"fmt"
"time"

"github.com/pkg/errors"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -376,12 +375,12 @@ func dockerMachineToDockerMachinePool(_ context.Context, o client.Object) []ctrl
return nil
}

// updateStatus updates the Status field for the MachineSet
// updateStatus updates the Status field for the MachinePool object.
// It checks for the current state of the replicas and updates the Status of the MachineSet.
func (r *DockerMachinePoolReconciler) updateStatus(ctx context.Context, cluster *clusterv1.Cluster, machinePool *expv1.MachinePool, dockerMachinePool *infraexpv1.DockerMachinePool, dockerMachines []infrav1.DockerMachine) (ctrl.Result, error) {
log := ctrl.LoggerFrom(ctx)

// List the Docker containers. This corresponds to a InfraMachinePool instance for providers.
// List the Docker containers. This corresponds to an InfraMachinePool instance for providers.
labelFilters := map[string]string{dockerMachinePoolLabel: dockerMachinePool.Name}
externalMachines, err := docker.ListMachinesByCluster(ctx, cluster, labelFilters)
if err != nil {
Expand Down Expand Up @@ -429,11 +428,6 @@ func (r *DockerMachinePoolReconciler) updateStatus(ctx context.Context, cluster
// Aggregate the operational state of all the machines; while aggregating we are adding the
// source ref (reason@machine/name) so the problem can be easily tracked down to its source machine.
conditions.SetAggregate(dockerMachinePool, expv1.ReplicasReadyCondition, getters, conditions.AddSourceRef(), conditions.WithStepCounterIf(false))
dockerMachinePool.Status.Ready = conditions.IsTrue(dockerMachinePool, expv1.ReplicasReadyCondition)

if !dockerMachinePool.Status.Ready {
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
}

return ctrl.Result{}, nil
}
Expand Down

0 comments on commit 91fa5c4

Please sign in to comment.