Skip to content

Commit d5a6c49

Browse files
committed
Avoid nilref when copying leader election options from custom config
1 parent 8bf49f1 commit d5a6c49

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/manager/manager.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,11 @@ func (o Options) AndFromOrDie(loader config.ControllerManagerConfiguration) Opti
494494
}
495495

496496
func (o Options) setLeaderElectionConfig(obj v1alpha1.ControllerManagerConfigurationSpec) Options {
497+
if obj.LeaderElection == nil {
498+
// The source does not have any configuration; noop
499+
return o
500+
}
501+
497502
if !o.LeaderElection && obj.LeaderElection.LeaderElect != nil {
498503
o.LeaderElection = *obj.LeaderElection.LeaderElect
499504
}

0 commit comments

Comments
 (0)