Skip to content

Commit

Permalink
Set machine.Ready to true
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuzu committed Jan 1, 2025
1 parent 6b6e7c0 commit 60085ad
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion internal/controller/incusmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,14 @@ func (r *IncusMachineReconciler) reconcileNormal(ctx context.Context, cluster *c
}
dataSecretName := *machine.Spec.Bootstrap.DataSecretName

_, err := r.IncusClient.GetInstance(ctx, incusMachine.Name)
output, err := r.IncusClient.GetInstance(ctx, incusMachine.Name)
if err == nil {
if r.isMachineReady(ctx, output) {
log.Info("IncusMachine instance is ready")

incusMachine.Status.Ready = true
}

return ctrl.Result{}, nil
}
if !errors.Is(err, incus.ErrorInstanceNotFound) {
Expand Down Expand Up @@ -325,6 +331,10 @@ func (r *IncusMachineReconciler) getBootstrapData(ctx context.Context, namespace
return string(value), bootstrapv1.Format(format), nil
}

func (r *IncusMachineReconciler) isMachineReady(ctx context.Context, output *incus.GetInstanceOutput) bool {

Check failure on line 334 in internal/controller/incusmachine_controller.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

`(*IncusMachineReconciler).isMachineReady` - `ctx` is unused (unparam)

Check failure on line 334 in internal/controller/incusmachine_controller.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

`(*IncusMachineReconciler).isMachineReady` - `ctx` is unused (unparam)
return output.StatusCode == api.Ready
}

// SetupWithManager sets up the controller with the Manager.
func (r *IncusMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error {
clusterToIncusMachines, err := util.ClusterToTypedObjectsMapper(mgr.GetClient(), &infrav1alpha1.IncusMachineList{}, mgr.GetScheme())
Expand Down

0 comments on commit 60085ad

Please sign in to comment.