Simplify leader election code

Kubernetes-commit: c891207ab7c9e8e2ffb75edf41e6525d57543773
This commit is contained in:
Jacek Kaniuk 2021-02-08 19:28:55 +01:00 committed by Kubernetes Publisher
parent 100613764a
commit 0eaf14c16e

View File

@ -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) {
// shallow copy, do not modify the kubeconfig
config := *kubeconfig
timeout := ((renewDeadline / time.Millisecond) / 2) * time.Millisecond
timeout := renewDeadline / 2
if timeout < time.Second {
timeout = time.Second
}