Skip to content

Commit

Permalink
Avoid nilref when copying leader election options from custom config
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasaschan committed May 6, 2022
1 parent 8bf49f1 commit d5a6c49
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,11 @@ func (o Options) AndFromOrDie(loader config.ControllerManagerConfiguration) Opti
}

func (o Options) setLeaderElectionConfig(obj v1alpha1.ControllerManagerConfigurationSpec) Options {
if obj.LeaderElection == nil {
// The source does not have any configuration; noop
return o
}

if !o.LeaderElection && obj.LeaderElection.LeaderElect != nil {
o.LeaderElection = *obj.LeaderElection.LeaderElect
}
Expand Down

0 comments on commit d5a6c49

Please sign in to comment.