mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-16 15:18:24 +00:00
fix: Update unit test to catch actual nil Labels case and fix functionality to handle nil Labels
Kubernetes-commit: 8d4108bf9355b086e7f8996e84723ca389db887a
This commit is contained in:
committed by
Kubernetes Publisher
parent
bccbbb3816
commit
706156ceaf
@@ -77,6 +77,9 @@ func (ll *LeaseLock) Update(ctx context.Context, ler LeaderElectionRecord) error
|
||||
ll.lease.Spec = LeaderElectionRecordToLeaseSpec(&ler)
|
||||
|
||||
if ll.Labels != nil {
|
||||
if ll.lease.Labels == nil {
|
||||
ll.lease.Labels = map[string]string{}
|
||||
}
|
||||
// Only overwrite the labels that are specifically set
|
||||
for k, v := range ll.Labels {
|
||||
ll.lease.Labels[k] = v
|
||||
|
Reference in New Issue
Block a user