mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #98059 from jprzychodzen/ld-kcm
[kube-controller-manager] Lower timeout for leaderelection resourcelock
This commit is contained in:
commit
76d1292930
@ -40,9 +40,6 @@ type Config struct {
|
||||
// the general kube client
|
||||
Client *clientset.Clientset
|
||||
|
||||
// the client only used for leader election
|
||||
LeaderElectionClient *clientset.Clientset
|
||||
|
||||
// the rest config for the master
|
||||
Kubeconfig *restclient.Config
|
||||
|
||||
|
@ -270,15 +270,15 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
|
||||
// add a uniquifier so that two processes on the same host don't accidentally both become active
|
||||
id = id + "_" + string(uuid.NewUUID())
|
||||
|
||||
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.ResourceName,
|
||||
c.LeaderElectionClient.CoreV1(),
|
||||
c.LeaderElectionClient.CoordinationV1(),
|
||||
resourcelock.ResourceLockConfig{
|
||||
Identity: id,
|
||||
EventRecorder: c.EventRecorder,
|
||||
})
|
||||
},
|
||||
c.Kubeconfig,
|
||||
c.ComponentConfig.Generic.LeaderElection.RenewDeadline.Duration)
|
||||
if err != nil {
|
||||
klog.Fatalf("error creating lock: %v", err)
|
||||
}
|
||||
|
@ -441,18 +441,12 @@ func (s KubeControllerManagerOptions) Config(allControllers []string, disabledBy
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// shallow copy, do not modify the kubeconfig.Timeout.
|
||||
config := *kubeconfig
|
||||
config.Timeout = s.Generic.LeaderElection.RenewDeadline.Duration
|
||||
leaderElectionClient := clientset.NewForConfigOrDie(restclient.AddUserAgent(&config, "leader-election"))
|
||||
|
||||
eventRecorder := createRecorder(client, KubeControllerManagerUserAgent)
|
||||
|
||||
c := &kubecontrollerconfig.Config{
|
||||
Client: client,
|
||||
Kubeconfig: kubeconfig,
|
||||
EventRecorder: eventRecorder,
|
||||
LeaderElectionClient: leaderElectionClient,
|
||||
}
|
||||
if err := s.ApplyTo(c); err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user