Prevent panic due to Annotations being nil map
This commit is contained in:
@@ -82,6 +82,9 @@ func (el *EndpointsLock) Update(ler LeaderElectionRecord) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if el.e.Annotations == nil {
|
||||||
|
el.e.Annotations = make(map[string]string)
|
||||||
|
}
|
||||||
el.e.Annotations[LeaderElectionRecordAnnotationKey] = string(recordBytes)
|
el.e.Annotations[LeaderElectionRecordAnnotationKey] = string(recordBytes)
|
||||||
el.e, err = el.Client.Endpoints(el.EndpointsMeta.Namespace).Update(el.e)
|
el.e, err = el.Client.Endpoints(el.EndpointsMeta.Namespace).Update(el.e)
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user