Apply feedback

Kubernetes-commit: bf851e8bcfa6213218c6352636dcc5114d83399c
This commit is contained in:
Joe Betz
2025-09-05 15:43:48 -04:00
committed by Kubernetes Publisher
parent 799b7635a9
commit fad66b0287
2 changed files with 14 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright 2021 The Kubernetes Authors.
Copyright 2025 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -373,15 +373,17 @@ func Example_leaderElection() {
}()
// Create the lock object.
lock := &resourcelock.LeaseLock{
LeaseMeta: metav1.ObjectMeta{
Name: leaseName,
Namespace: leaseNamespace,
},
Client: clientset.CoordinationV1(),
LockConfig: resourcelock.ResourceLockConfig{
lock, err := resourcelock.New(resourcelock.LeasesResourceLock,
leaseNamespace,
leaseName,
clientset.CoreV1(),
clientset.CoordinationV1(),
resourcelock.ResourceLockConfig{
Identity: id,
},
})
if err != nil {
fmt.Printf("Error creating lock: %v\n", err)
return
}
// Create the leader elector.