Skip to content

Commit 500dd98

Browse files
committed
re-added nil check and fixed ready condition
1 parent a79c7d8 commit 500dd98

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

controllers/openstackmachine_controller.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ func (r *OpenStackMachineReconciler) reconcileDelete(scope scope.Scope, cluster
301301
// reconcileFloatingAddressFromPool creates IPAddressClaims for the OpenStackMachine if the OpenStackMachine has a
302302
// FloatingAddressFromPool specified. It then associates the IPAddressClaim with the instance.
303303
func (r *OpenStackMachineReconciler) reconcileFloatingAddressFromPool(ctx context.Context, scope scope.Scope, openStackMachine *infrav1.OpenStackMachine, openStackCluster *infrav1.OpenStackCluster, instanceStatus *compute.InstanceStatus, instanceNS *compute.InstanceNetworkStatus) error {
304+
if openStackMachine.Spec.FloatingAddressFromPool == nil {
305+
return nil
306+
}
307+
304308
networkingService, err := networking.NewService(scope)
305309
if err != nil {
306310
return err
@@ -491,8 +495,9 @@ func (r *OpenStackMachineReconciler) reconcileNormal(ctx context.Context, scope
491495

492496
switch instanceStatus.State() {
493497
case infrav1.InstanceStateActive:
494-
if openStackMachine.Spec.FloatingAddressFromPool != nil && pointer.BoolDeref(openStackMachine.Status.FloatingAddressFromPoolReady, false) {
498+
if openStackMachine.Spec.FloatingAddressFromPool == nil || pointer.BoolDeref(openStackMachine.Status.FloatingAddressFromPoolReady, false) {
495499
scope.Logger().Info("Machine instance state is ACTIVE", "id", instanceStatus.ID())
500+
openStackMachine.Status.Ready = true
496501
conditions.MarkTrue(openStackMachine, infrav1.InstanceReadyCondition)
497502
} else {
498503
scope.Logger().Info("Machine instance state is ACTIVE, but floating IP is not ready yet", "id", instanceStatus.ID())

0 commit comments

Comments
 (0)