@@ -301,12 +301,6 @@ func (r *OpenStackMachineReconciler) reconcileDelete(scope scope.Scope, cluster
301
301
// reconcileFloatingAddressFromPool creates IPAddressClaims for the OpenStackMachine if the OpenStackMachine has a
302
302
// FloatingAddressFromPool specified. It then associates the IPAddressClaim with the instance.
303
303
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
- conditions .MarkTrue (openStackMachine , infrav1 .FloatingAddressFromPoolReadyCondition )
306
- openStackMachine .Status .FloatingAddressFromPoolReady = pointer .BoolPtr (true )
307
- return nil
308
- }
309
-
310
304
networkingService , err := networking .NewService (scope )
311
305
if err != nil {
312
306
return err
@@ -362,7 +356,7 @@ func (r *OpenStackMachineReconciler) reconcileFloatingAddressFromPool(ctx contex
362
356
instanceAddresses := instanceNS .Addresses ()
363
357
for _ , instanceAddress := range instanceAddresses {
364
358
if instanceAddress .Address == address .Spec .Address {
365
- openStackMachine .Status .FloatingAddressFromPoolReady = pointer .BoolPtr (true )
359
+ openStackMachine .Status .FloatingAddressFromPoolReady = pointer .Bool (true )
366
360
conditions .MarkTrue (openStackMachine , infrav1 .FloatingAddressFromPoolReadyCondition )
367
361
return nil
368
362
}
@@ -391,18 +385,19 @@ func (r *OpenStackMachineReconciler) reconcileFloatingAddressFromPool(ctx contex
391
385
return err
392
386
}
393
387
}
394
- openStackMachine .Status .FloatingAddressFromPoolReady = pointer .BoolPtr (true )
388
+ openStackMachine .Status .FloatingAddressFromPoolReady = pointer .Bool (true )
395
389
conditions .MarkTrue (openStackMachine , infrav1 .FloatingAddressFromPoolReadyCondition )
396
390
} else {
397
391
scope .Logger ().Info ("Waiting for IPAddressClaim to be allocated" , "name" , claim .Name )
398
- openStackMachine .Status .FloatingAddressFromPoolReady = pointer .BoolPtr (false )
392
+ openStackMachine .Status .FloatingAddressFromPoolReady = pointer .Bool (false )
399
393
conditions .MarkFalse (openStackMachine , infrav1 .FloatingAddressFromPoolReadyCondition , infrav1 .FloatingAddressFromPoolWaitingForIpamProviderReason , clusterv1 .ConditionSeverityWarning , "" )
400
394
}
401
395
return nil
402
396
}
403
397
404
398
func (r * OpenStackMachineReconciler ) reconcileDeleteFloatingAddressFromPool (scope scope.Scope , openStackMachine * infrav1.OpenStackMachine ) error {
405
- scope .Logger ().Info ("Reconciling floating IP claims delete" )
399
+ log := scope .Logger ().WithValues ("openStackMachine" , openStackMachine .Name )
400
+ log .Info ("Reconciling Machine delete floating address from pool" )
406
401
if openStackMachine .Spec .FloatingAddressFromPool == nil {
407
402
return nil
408
403
}
@@ -496,7 +491,7 @@ func (r *OpenStackMachineReconciler) reconcileNormal(ctx context.Context, scope
496
491
497
492
switch instanceStatus .State () {
498
493
case infrav1 .InstanceStateActive :
499
- if pointer .BoolDeref (openStackMachine .Status .FloatingAddressFromPoolReady , false ) {
494
+ if openStackMachine . Spec . FloatingAddressFromPool != nil && pointer .BoolDeref (openStackMachine .Status .FloatingAddressFromPoolReady , false ) {
500
495
scope .Logger ().Info ("Machine instance state is ACTIVE" , "id" , instanceStatus .ID ())
501
496
conditions .MarkTrue (openStackMachine , infrav1 .InstanceReadyCondition )
502
497
} else {
0 commit comments