mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-15 22:58:24 +00:00
Validate lock identity
Ensure that the lock identity is not empty. This can cause unexpected issues during leader election. Kubernetes-commit: 5519b89a28eeea5a5b134092242aff770fcc07eb
This commit is contained in:
committed by
Kubernetes Publisher
parent
151a5919db
commit
0011bf6b0b
@@ -99,6 +99,11 @@ func NewLeaderElector(lec LeaderElectionConfig) (*LeaderElector, error) {
|
||||
if lec.Lock == nil {
|
||||
return nil, fmt.Errorf("Lock must not be nil.")
|
||||
}
|
||||
id := lec.Lock.Identity()
|
||||
if id == "" {
|
||||
return nil, fmt.Errorf("Lock identity is empty")
|
||||
}
|
||||
|
||||
le := LeaderElector{
|
||||
config: lec,
|
||||
clock: clock.RealClock{},
|
||||
|
Reference in New Issue
Block a user