mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-24 22:23:02 +00:00
Check Annotations map against nil for ConfigMapLock#Update()
Signed-off-by: Ted Yu <yuzhihong@gmail.com> Kubernetes-commit: 086d6ae9bbbe95e0740e7dd44fa08c31409f8bec
This commit is contained in:
parent
7039b495eb
commit
1ff0856e81
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user