Skip to content

Commit

Permalink
Always trigger one initial reconciliation
Browse files Browse the repository at this point in the history
  • Loading branch information
chdxD1 committed Nov 15, 2024
1 parent c334ded commit cd11edc
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ func main() {
}

func initComponents(mgr manager.Manager, anycastTracker *anycast.Tracker, cfg *config.Config, clientConfig *rest.Config, onlyBPFMode bool) error {
// Start VRFRouteConfigurationReconciler when we are not running in only BPF mode.
if !onlyBPFMode {
if err := setupReconcilers(mgr, anycastTracker); err != nil {
return fmt.Errorf("unable to setup reconcilers: %w", err)
}
}
//+kubebuilder:scaffold:builder

if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
Expand Down Expand Up @@ -223,34 +217,41 @@ func initComponents(mgr manager.Manager, anycastTracker *anycast.Tracker, cfg *c
if err = performNetworkingHealthcheck(hc); err != nil {
return fmt.Errorf("error performing healthcheck: %w", err)
}
} else {
// Start VRFRouteConfigurationReconciler when we are not running in only BPF mode.
r, err := reconciler.NewReconciler(mgr.GetClient(), anycastTracker, mgr.GetLogger())
if err != nil {
return fmt.Errorf("unable to create debounced reconciler: %w", err)
}
if err := setupReconcilers(r, mgr, anycastTracker); err != nil {
return fmt.Errorf("unable to setup reconcilers: %w", err)
}

// Trigger initial reconciliation.
r.Reconcile(context.Background())
}

return nil
}

func setupReconcilers(mgr manager.Manager, anycastTracker *anycast.Tracker) error {
r, err := reconciler.NewReconciler(mgr.GetClient(), anycastTracker, mgr.GetLogger())
if err != nil {
return fmt.Errorf("unable to create debounced reconciler: %w", err)
}

if err = (&controllers.VRFRouteConfigurationReconciler{
func setupReconcilers(r *reconciler.Reconciler, mgr manager.Manager, anycastTracker *anycast.Tracker) error {

Check failure on line 237 in cmd/manager/main.go

View workflow job for this annotation

GitHub Actions / lint

unused-parameter: parameter 'anycastTracker' seems to be unused, consider removing or renaming it as _ (revive)
if err := (&controllers.VRFRouteConfigurationReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Reconciler: r,
}).SetupWithManager(mgr); err != nil {
return fmt.Errorf("unable to create VRFRouteConfiguration controller: %w", err)
}

if err = (&controllers.Layer2NetworkConfigurationReconciler{
if err := (&controllers.Layer2NetworkConfigurationReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Reconciler: r,
}).SetupWithManager(mgr); err != nil {
return fmt.Errorf("unable to create Layer2NetworkConfiguration controller: %w", err)
}

if err = (&controllers.RoutingTableReconciler{
if err := (&controllers.RoutingTableReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Reconciler: r,
Expand Down

0 comments on commit cd11edc

Please sign in to comment.