Skip to content

Commit 546e624

Browse files
committed
Try fetching IPAddress before getting ip from openstack
1 parent c76baeb commit 546e624

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

controllers/openstackfloatingippool_controller.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,18 @@ func (r *OpenStackFloatingIPPoolReconciler) Reconcile(ctx context.Context, req c
121121
}
122122

123123
if claim.Status.AddressRef.Name == "" {
124-
ip, err := r.getIP(ctx, scope, pool)
125-
if err != nil {
126-
return ctrl.Result{}, err
127-
}
128-
129-
// try to get the ipaddress
130124
ipAddress := &ipamv1.IPAddress{}
131125
if err := r.Client.Get(ctx, client.ObjectKey{Name: claim.Name, Namespace: claim.Namespace}, ipAddress); err == nil {
132126
// IPAddress already exists, another reconciler is working on it
133-
log.Info("IPAddress already exists, another reconciler is working on it", "ip", ip)
127+
log.Info("IPAddress already exists, another reconciler is working on it")
134128
continue
135129
}
136130

131+
ip, err := r.getIP(ctx, scope, pool)
132+
if err != nil {
133+
return ctrl.Result{}, err
134+
}
135+
137136
ipAddress = &ipamv1.IPAddress{
138137
ObjectMeta: ctrl.ObjectMeta{
139138
Name: claim.Name,

0 commit comments

Comments
 (0)