Merge pull request #87821 from tedyu/cfg-map-update

Check Annotations map against nil for ConfigMapLock#Update()

Kubernetes-commit: 1cf634d24c0f8eefb7259519f9bec2bea40dafd9
This commit is contained in:
Kubernetes Publisher 2020-04-03 22:41:46 -07:00
commit 8e91b7aa91

View File

@ -88,6 +88,9 @@ func (cml *ConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord)
if err != nil {
return err
}
if cml.cm.Annotations == nil {
cml.cm.Annotations = make(map[string]string)
}
cml.cm.Annotations[LeaderElectionRecordAnnotationKey] = string(recordBytes)
cml.cm, err = cml.Client.ConfigMaps(cml.ConfigMapMeta.Namespace).Update(ctx, cml.cm, metav1.UpdateOptions{})
return err