mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #98889 from jkaniuk/leaderelection-simplify
Simplify leader election code
This commit is contained in:
commit
93d288e2a4
@ -151,7 +151,7 @@ func New(lockType string, ns string, name string, coreClient corev1.CoreV1Interf
|
|||||||
func NewFromKubeconfig(lockType string, ns string, name string, rlc ResourceLockConfig, kubeconfig *restclient.Config, renewDeadline time.Duration) (Interface, error) {
|
func NewFromKubeconfig(lockType string, ns string, name string, rlc ResourceLockConfig, kubeconfig *restclient.Config, renewDeadline time.Duration) (Interface, error) {
|
||||||
// shallow copy, do not modify the kubeconfig
|
// shallow copy, do not modify the kubeconfig
|
||||||
config := *kubeconfig
|
config := *kubeconfig
|
||||||
timeout := ((renewDeadline / time.Millisecond) / 2) * time.Millisecond
|
timeout := renewDeadline / 2
|
||||||
if timeout < time.Second {
|
if timeout < time.Second {
|
||||||
timeout = time.Second
|
timeout = time.Second
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user