Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ellistarn committed Dec 3, 2021
1 parent 2ac4e4c commit 151a2dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func main() {

// Set up controller runtime controller
cloudProvider := registry.NewCloudProvider(ctx, cloudprovider.Options{ClientSet: clientSet})
manager := controllers.NewManagerOrDie(config, controllerruntime.Options{
manager := controllers.NewManagerOrDie(ctx, config, controllerruntime.Options{
Logger: zapr.NewLogger(logging.FromContext(ctx).Desugar()),
LeaderElection: true,
LeaderElectionID: "karpenter-leader-election",
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ type GenericControllerManager struct {
}

// NewManagerOrDie instantiates a controller manager or panics
func NewManagerOrDie(config *rest.Config, options controllerruntime.Options) Manager {
func NewManagerOrDie(ctx context.Context, config *rest.Config, options controllerruntime.Options) Manager {
newManager, err := controllerruntime.NewManager(config, options)
if err != nil {
panic(fmt.Sprintf("Failed to create controller newManager, %s", err.Error()))
}
if err := newManager.GetFieldIndexer().IndexField(context.Background(), &v1.Pod{}, "spec.nodeName", podSchedulingIndex); err != nil {
if err := newManager.GetFieldIndexer().IndexField(ctx, &v1.Pod{}, "spec.nodeName", podSchedulingIndex); err != nil {
panic(fmt.Sprintf("Failed to setup pod indexer, %s", err.Error()))
}
return &GenericControllerManager{Manager: newManager}
Expand Down

0 comments on commit 151a2dd

Please sign in to comment.