mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-25 22:51:40 +00:00
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:
commit
8e91b7aa91
@ -88,6 +88,9 @@ func (cml *ConfigMapLock) Update(ctx context.Context, ler LeaderElectionRecord)
|
|||||||
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(ctx, cml.cm, metav1.UpdateOptions{})
|
cml.cm, err = cml.Client.ConfigMaps(cml.ConfigMapMeta.Namespace).Update(ctx, cml.cm, metav1.UpdateOptions{})
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user