Skip to content

Commit

Permalink
Fix an issue that leads to ExternalIP attachment on unwanted nodes (#122
Browse files Browse the repository at this point in the history
)
  • Loading branch information
vincentmrg authored Mar 14, 2024
1 parent 24d6582 commit b4b7db9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions controllers/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ func (r *NodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
return ctrl.Result{}, err
}

// RequeueAfter can lead to node reconciliation which may not have the
// externalip-auto-assign label, in this case we end the reconciliation.
if !helper.ContainsElements(node.Labels, map[string]string{externalIPAutoAssignLabel: "true"}) {
log.V(1).Info("externalip-auto-assign label removed, stopping reconciliation")
delete(r.lastReconciliation, req.Name)
return ctrl.Result{}, nil
}

// Store reconciliation time to handle reconciliation interval
r.lastReconciliation[req.Name] = time.Now()

Expand Down

0 comments on commit b4b7db9

Please sign in to comment.