Check Annotations map against nil for ConfigMapLock#Update()
Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
@@ -86,6 +86,9 @@ func (cml *ConfigMapLock) Update(ler LeaderElectionRecord) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if cml.cm.Annotations == nil {
|
||||||
|
cml.cm.Annotations = make(map[string]string)
|
||||||
|
}
|
||||||
cml.cm.Annotations[LeaderElectionRecordAnnotationKey] = string(recordBytes)
|
cml.cm.Annotations[LeaderElectionRecordAnnotationKey] = string(recordBytes)
|
||||||
cml.cm, err = cml.Client.ConfigMaps(cml.ConfigMapMeta.Namespace).Update(cml.cm)
|
cml.cm, err = cml.Client.ConfigMaps(cml.ConfigMapMeta.Namespace).Update(cml.cm)
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user