Skip to content

Commit

Permalink
fix some nil pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
sbueringer committed Aug 10, 2021
1 parent 9b303c9 commit aa4a842
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions exp/addons/controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,33 @@ var (
func TestMain(m *testing.M) {
setupIndexes := func(ctx context.Context, mgr ctrl.Manager) {
// Set up the MachineNodeIndex
if err := noderefutil.AddMachineNodeIndex(ctx, env.Manager); err != nil {
if err := noderefutil.AddMachineNodeIndex(ctx, mgr); err != nil {
panic(fmt.Sprintf("unable to setup machine node index: %v", err))
}

// Set up the MachineProviderIDIndex
if err := noderefutil.AddMachineProviderIDIndex(ctx, env.Manager); err != nil {
if err := noderefutil.AddMachineProviderIDIndex(ctx, mgr); err != nil {
panic(fmt.Sprintf("unable to setup machine providerID index: %v", err))
}
}

setupReconcilers := func(ctx context.Context, mgr ctrl.Manager) {
tracker, err := remote.NewClusterCacheTracker(env.Manager, remote.ClusterCacheTrackerOptions{})
tracker, err := remote.NewClusterCacheTracker(mgr, remote.ClusterCacheTrackerOptions{})
if err != nil {
panic(fmt.Sprintf("Failed to create new cluster cache tracker: %v", err))
}

reconciler := ClusterResourceSetReconciler{
Client: env,
Client: mgr.GetClient(),
Tracker: tracker,
}
if err = reconciler.SetupWithManager(ctx, env.Manager, controller.Options{MaxConcurrentReconciles: 1}); err != nil {
if err = reconciler.SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: 1}); err != nil {
panic(fmt.Sprintf("Failed to set up cluster resource set reconciler: %v", err))
}
bindingReconciler := ClusterResourceSetBindingReconciler{
Client: env,
Client: mgr.GetClient(),
}
if err = bindingReconciler.SetupWithManager(ctx, env.Manager, controller.Options{MaxConcurrentReconciles: 1}); err != nil {
if err = bindingReconciler.SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: 1}); err != nil {
panic(fmt.Sprintf("Failed to set up cluster resource set binding reconciler: %v", err))
}
}
Expand Down
10 changes: 5 additions & 5 deletions exp/controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ var (
func TestMain(m *testing.M) {
setupIndexes := func(ctx context.Context, mgr ctrl.Manager) {
// Set up the MachineNodeIndex
if err := noderefutil.AddMachineNodeIndex(ctx, env.Manager); err != nil {
if err := noderefutil.AddMachineNodeIndex(ctx, mgr); err != nil {
panic(fmt.Sprintf("unable to setup machine node index: %v", err))
}

// Set up the MachineProviderIDIndex
if err := noderefutil.AddMachineProviderIDIndex(ctx, env.Manager); err != nil {
if err := noderefutil.AddMachineProviderIDIndex(ctx, mgr); err != nil {
panic(fmt.Sprintf("unable to setup machine providerID index: %v", err))
}
}

setupReconcilers := func(ctx context.Context, mgr ctrl.Manager) {
machinePoolReconciler := MachinePoolReconciler{
Client: env,
recorder: env.GetEventRecorderFor("machinepool-controller"),
Client: mgr.GetClient(),
recorder: mgr.GetEventRecorderFor("machinepool-controller"),
}
err := machinePoolReconciler.SetupWithManager(ctx, env.Manager, controller.Options{MaxConcurrentReconciles: 1})
err := machinePoolReconciler.SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: 1})
if err != nil {
panic(fmt.Sprintf("Failed to set up machine pool reconciler: %v", err))
}
Expand Down

0 comments on commit aa4a842

Please sign in to comment.