Merge pull request #98061 from jprzychodzen/le-ccm

[cloud-controller-manager] Lower timeout for leaderelection resourcelock
This commit is contained in:
Kubernetes Prow Robot 2021-01-26 02:36:46 -08:00 committed by GitHub
commit 0bf274d471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 9 deletions

View File

@ -42,9 +42,6 @@ type Config struct {
// the general kube client // the general kube client
Client *clientset.Clientset Client *clientset.Clientset
// the client only used for leader election
LeaderElectionClient *clientset.Clientset
// the rest config for the master // the rest config for the master
Kubeconfig *restclient.Config Kubeconfig *restclient.Config

View File

@ -186,15 +186,15 @@ func Run(c *cloudcontrollerconfig.CompletedConfig, controllerInitializers map[st
id = id + "_" + string(uuid.NewUUID()) id = id + "_" + string(uuid.NewUUID())
// Lock required for leader election // Lock required for leader election
rl, err := resourcelock.New(c.ComponentConfig.Generic.LeaderElection.ResourceLock, rl, err := resourcelock.NewFromKubeconfig(c.ComponentConfig.Generic.LeaderElection.ResourceLock,
c.ComponentConfig.Generic.LeaderElection.ResourceNamespace, c.ComponentConfig.Generic.LeaderElection.ResourceNamespace,
c.ComponentConfig.Generic.LeaderElection.ResourceName, c.ComponentConfig.Generic.LeaderElection.ResourceName,
c.LeaderElectionClient.CoreV1(),
c.LeaderElectionClient.CoordinationV1(),
resourcelock.ResourceLockConfig{ resourcelock.ResourceLockConfig{
Identity: id, Identity: id,
EventRecorder: c.EventRecorder, EventRecorder: c.EventRecorder,
}) },
c.Kubeconfig,
c.ComponentConfig.Generic.LeaderElection.RenewDeadline.Duration)
if err != nil { if err != nil {
klog.Fatalf("error creating lock: %v", err) klog.Fatalf("error creating lock: %v", err)
} }

View File

@ -188,8 +188,6 @@ func (o *CloudControllerManagerOptions) ApplyTo(c *config.Config, userAgent stri
return err return err
} }
c.LeaderElectionClient = clientset.NewForConfigOrDie(restclient.AddUserAgent(c.Kubeconfig, "leader-election"))
c.EventRecorder = createRecorder(c.Client, userAgent) c.EventRecorder = createRecorder(c.Client, userAgent)
rootClientBuilder := clientbuilder.SimpleControllerClientBuilder{ rootClientBuilder := clientbuilder.SimpleControllerClientBuilder{